my $sites_conf = "$ENV{'HOME'}/.newsboxes/sites.conf"; my %sites_config = parse_sites_config(); sub parse_sites_config { open SITES_CFG, "< $sites_conf" or die "Couldn't open $sites_conf: $!\n"; my %options; while() { chomp; s/\/\/\s+.*//g; # Get rid of comments; next unless length; if (my($key, $operator, $value) = /^\s*?(\S+)\s*?(\=\>?)\s*?(\S+)\s*$/) { if ($operator eq "=>") { ++$options{'total_sites'}; $options{$options{'total_sites'}}{'site_name'} = $key; $options{$options{'total_sites'}}{'site_url'} = $value; } elsif ($operator eq "=") { $options{$options{'total_sites'}}{$key} = $value; } else { die "Ooops you might want to check $sites_conf for errors for site: $options{$options{'total_sites'}}{'site_name'}\n"; } } } return %options; } #### Kuro5hin => http://www.kuro5hin.org key = k5 story_tag = item title_tag = title link_tag = link site_xml = http://www.kuro5hin.org/backend.rdf refresh = 1800 colour_1 = #302BA2 colour_2 = #FFFFFF colour_3 = #E0E0E0 colour_4 = #302BA2