# # You need XML::Simple, just type perl -MCPAN -e shell and then 'install # XML::Simple' # package xml; use XML::Simple; sub init { use vars qw/$xml_output/; } sub homesite_init { $xml_output = ""; } sub add { my %hash = %{$_[1]}; for my $m (0 .. $#{$hash{data}}) { $hash{data}[$m]{head} =~ s/(http:\/\/[^\s]+)/$1<\/a>/ig if defined($hash{data}[$m]{head}); $hash{data}[$m]{text} =~ s/(http:\/\/[^\s]+)/$1<\/a>/ig if defined($hash{data}[$m]{text});; } my $xs = new XML::Simple(forcearray => 1, keeproot => 1); $xml_output .= $xs->XMLout(\%hash) . "\n"; my $file = "$ENV{HOME}/.SomeNEWS/".$hash{name}.".xml"; if(!open (FILE, ">$file")) { print STDERR "Can't open $file\n"; exit 0; } print FILE $xml_output; close(FILE); } sub end { } 1;