Strange behaviour of LWP::UserAgent

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I'm trying to use LWP::UserAgent on Kubuntu 10.04.

When setting a proxy, I use this code to load my wget's proxy settings:

if (open(my $wgetrc, '<', $ENV . '/.wgetrc')) {
    while (<$wgetrc>) {
        if (/(http|ftp|https)_proxy\s*=\s*(\S+)/) {
            print STDERR "$ua->proxy($1, $2)\n";
            my $old = $ua->proxy($1, $2);
            print "... was ", $old ? $old : 'None', "\n";
            # push @protocols_allowed, $1;
        } elsif (/user-agent\s*=\s*(\S.*\S)\s*$/) {
            print STDERR "$ua->agent($1)\n";
    close $wgetrc;

The prints all come out OK, showing the proxy URLs like
$ua->proxy(http, http://<proxy-address>:81/)
$ua->proxy(https, http://<proxy-address>:81/)
$ua->proxy(ftp, http://<proxy-address>:81/)

However, a $ua->get(' /') fails.

I've taken the liberty (being root ;-) to insert a few prints into the
sub proxy in /usr/share/perl5/LWP/ and found that prior to
the Carp::croak("'$key' is not a valid URI scheme") unless $key =~
@_ contained the proxy-URL and after that command, @_[0] is empty!

When I comment that line, the $ua->get(' /') succeeds.

Does anybody have an idea what happens?

These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
    If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details:

Site Timeline