# ----------------------------------------------------- sub _setAgent { $XAgent = LWP::UserAgent->new(keep_alive => 1); $XAgent->default_header('Accept-Charset' => 'ISO-8859-1,utf-8'); $XAgent->agent($ENV{'HTTP_USER_AGENT'}); $XAgent->cookie_jar({}); # allow cookies }; #### # ----------------------------------------------------- sub _getUrl { return $XAgent->get(shift)->decoded_content(); }; #### # ----------------------------------------------------- my $xml = _getUrl($url); my $p = XML::Parser->new(Style => 'Stream', Pkg => 'some_pkg', ProtocolEncoding => "utf-8"); $p->parse($xml);