in reply to Uninitialized $scheme variable in LWP::Protocol and LWP::UserAgent problem

It seems from the use in LWP::UserAgent that $scheme is just the first part of a http address, like 'https', 'http', 'file' ...

The code in UserAgent uses the scheme of the http address it wants to access, except when it has to go through a proxy. Then it uses the scheme of the proxy instead.

I'm only making wild guesses now, but your problem could still come from the proxy handling. You might check your environment variables, maybe there is a malformed proxy definition there:

#bash set | grep -i proxy #csh/tcsh printenv | grep -i proxy
I would also recommend deleting .cpan in your homedir (or roots homedir) and so resetting your configuration of cpan. Since you have these problems with other scripts too, the chance that this will help is not very high but doesn't hurt to try

You might create a minimal LWP program (just accessing a web page), and use LWP::Debug to create a logfile. Check the logfile or post it here (together with the version of perl you are using).

UPDATE: minor clarification

  • Comment on Re: Uninitialized $scheme variable in LWP::Protocol and LWP::UserAgent problem
  • Download Code

Replies are listed 'Best First'.
Re^2: Uninitialized $scheme variable in LWP::Protocol and LWP::UserAgent problem
by rogerd (Sexton) on Jul 27, 2008 at 15:38 UTC

    Thank you. I discovered that my environment variables FTP_PROXY and HTTP_PROXY where been set to some value that I used at the University. I set manually those variables to qw{} and now I don't get the errors. I also could run a small script using LWP that used to fail, and it works.

    Now, I have the problem that some program is automatically setting the proxy environment variables to that value, and I have to manually reset them to reflect my actual network configurations. I have to discover which program is doing that.

    Also, I have to learn some more about proxies, and how to use them with LWP.

    Thank you again... I have now a lot of read and work, but at least I know where to start.