Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Protocol scheme 'http' is not supported

by ggerke (Novice)
on Jul 27, 2012 at 20:44 UTC ( #984098=perlquestion: print w/ replies, xml ) Need Help??
ggerke has asked for the wisdom of the Perl Monks concerning the following question:

Most wise and virile Monks, please show me the error of my ways.

I'm having what I think is a problem with modules (not) being installed but I'm not finding the one that's actually causing me grief. I've got the following:

#!/usr/bin/perl use strict; use warnings; use diagnostics; use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->get('http://www.perlmonks.com/'); print $mech->content;

that generates the following:

Uncaught exception from user code: Error GETing http://www.perlmonks.com/: Protocol scheme 'http' is not supported at ./test2.pl line 9. at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 2751.

WWW::Mechanize::_die('Error ', 'GET', 'ing ', 'URI::http=SCALAR(0x10dbc80)', ': ', 'Protocol scheme \'http\' is not supported') called at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 2738

WWW::Mechanize::die('WWW::Mechanize=HASH(0xed47d0)', 'Error ', 'GET', 'ing ', 'URI::http=SCALAR(0x10dbc80)', ': ', 'Protocol scheme \'http\' is not supported') called at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 2385

WWW::Mechanize::_update_page('WWW::Mechanize=HASH(0xed47d0)', 'HTTP::Request=HASH(0x10dbea0)', 'HTTP::Response=HASH(0x1162710)') called at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 2217

WWW::Mechanize::request('WWW::Mechanize=HASH(0xed47d0)', 'HTTP::Request=HASH(0x10dbea0)') called at /usr/lib/perl5/site_perl/5.8.8/LWP/UserAgent.pm line 410

LWP::UserAgent::get('WWW::Mechanize=HASH(0xed47d0)', 'http://www.perlmonks.com/') called at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 407

WWW::Mechanize::get('WWW::Mechanize=HASH(0xed47d0)', 'http://www.perlmonks.com/') called at ./test2.pl line 9

I'm "blessed" with using at Perl 5.8.8 on a RHEL 5.8 server and getting up to current isn't a healthy option at this time. As far as WWW::Mechanize I've got the following on the machine:

$ ls -l /usr/lib/perl5/site_perl/5.8.8/WWW total 104 drwxr-xr-x 2 root root 4096 Jul 23 12:56 Mechanize -rwxr-xr-x 1 root root 79472 Feb 2 16:38 Mechanize.pm drwxr-xr-x 2 root root 4096 Jul 23 12:47 RobotRules -rwxr-xr-x 1 root root 11155 Feb 18 06:05 RobotRules.pm $ ls -l /usr/lib/perl5/site_perl/5.8.8/LWP/Protocol/http.pm -r--r--r-- 1 root root 13822 Feb 11 08:02 /usr/lib/perl5/site_perl/5.8 +.8/LWP/Protocol/http.pm $ sudo perl -MCPAN -e shell cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan[1]> +install WWW::Mechanize WWW::Mechanize is up to date (1.72). cpan[2]> install LWP::UserAgent LWP::UserAgent is up to date (6.04). cpan[3]> install LWP::Protocol LWP::Protocol is up to date (6.00). cpan[4]> install HTTP::Request HTTP::Request is up to date (6.00). cpan[5]> install HTTP::Response HTTP::Response is up to date (6.03).

I'm just not seeing what I'm missing in order to get just this little bit 'o code to run. Help me, Obi Perl - you're my only hope.

Comment on Protocol scheme 'http' is not supported
Select or Download Code
Re: Protocol scheme 'http' is not supported
by kcott (Abbot) on Jul 27, 2012 at 21:55 UTC

    $mech->get( $uri ) returns an HTTP::Response object. Try changing

    $mech->get('http://www.perlmonks.com/'); print $mech->content;

    to

    my $http_response_object = $mech->get('http://www.perlmonks.com/'); print $http_response_object->content;

    This worked for me:

    $ perl -e 'use WWW::Mechanize; my $mech = WWW::Mechanize->new; my $hro + = $mech->get(q{http://www.perlmonks.com/}); print $hro->content' | l +ess

    -- Ken

      Thanks for the reply. Unfortunately I get the same results...

      $ perl -e 'use WWW::Mechanize; my $mech = WWW::Mechanize->new; my $hro= $mech->get(q{http://www.perlmonks.com/}); print $hro->content'

      Error GETing http://www.perlmonks.com/: Protocol scheme 'http' is not supported at -e line 1.

      However, oddly enough if I do the same command with sudo I get the following:

      $ sudo perl -e 'use WWW::Mechanize; my $mech = WWW::Mechanize->new; my $hro= $mech->get(q{http://www.perlmonks.com/}); print $hro->content'

      HTML::Parser object version 3.69 does not match bootstrap parameter 3.55 at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/XSLoader.pm line 94.

      Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/HTML/Entities.pm line 152.

      Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/HTML/TokeParser.pm line 9.

      BEGIN failed--compilation aborted at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/HTML/TokeParser.pm line 9.

      Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 134.

      BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 134.

      Compilation failed in require at -e line 1.

      BEGIN failed--compilation aborted at -e line 1.

      So I checked HTML::Parser and the rest and found:

      $ sudo perl -MCPAN -e shell

      cpan shell -- CPAN exploration and modules installation (v1.9800) Ente +r 'h' for help. cpan[1]> install HTML::Parser HTML::Parser is up to date (3.69). cpan[2]> install XSLoader XSLoader is up to date (0.15). cpan[3]> install HTML::Entities HTML::Entities is up to date (3.69). cpan[4]> install HTML::TokeParser HTML::TokeParser is up to date (3.69). cpan[5]> install WWW::Mechanize WWW::Mechanize is up to date (1.72).

      And then looking at my @INC and doing some find'ing I'm seeing:

      $ perl -e 'print join("\n",@INC);' /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 . $ $ $ sudo find /usr -name Mechanize.pm -exec ls -l {} \; -rwxr-xr-x 1 root root 79472 Feb 2 16:38 /usr/lib/perl5/site_perl/5.8 +.8/WWW/Mechanize.pm $ $ $ sudo find /usr -name Parser.pm -exec ls -l {} \; -r--r--r-- 1 root root 39789 Oct 15 2011 /usr/lib64/perl5/site_perl/5 +.8.8/x86_64-linux-thread-multi/HTML/Parser.pm -rw-r--r-- 1 root root 39509 Jul 10 2006 /usr/lib64/perl5/vendor_perl +/5.8.8/x86_64-linux-thread-multi/HTML/Parser.pm -rw-r--r-- 1 root root 27103 Aug 18 2003 /usr/lib64/perl5/vendor_perl +/5.8.8/x86_64-linux-thread-multi/XML/Parser.pm -rw-r--r-- 1 root root 64063 Dec 16 2011 /usr/lib/perl5/5.8.8/Pod/Par +ser.pm -r--r--r-- 1 root root 51259 Feb 20 2011 /usr/lib/perl5/5.8.8/TAP/Par +ser.pm $ $ $ sudo find /usr -name TokeParser.pm -exec ls -l {} \; -r--r--r-- 1 root root 10104 Oct 15 2011 /usr/lib64/perl5/site_perl/5 +.8.8/x86_64-linux-thread-multi/HTML/TokeParser.pm -rw-r--r-- 1 root root 10134 Apr 26 2006 /usr/lib64/perl5/vendor_perl +/5.8.8/x86_64-linux-thread-multi/HTML/TokeParser.pm $

      Does any of that give a clue as to what's going on here...?

        With all the same versions you show above and in your OP, I cannot reproduce your problem. I have a newer version of Perl than you and I'm on a different architecture:

        $ perl -V Summary of my perl5 (revision 5 version 14 subversion 2) configuration +: Platform: osname=darwin, osvers=11.3.0, archname=darwin-thread-multi-2level uname='darwin ganymede 11.3.0 darwin kernel version 11.3.0: thu ja +n 12 18:47:41 pst 2012; root:xnu-1699.24.23~1release_x86_64 x86_64 '

        I noticed a discrepancy between versions for HTML::Parser. When you used sudo (above), 3.69 was returned without error:

        $ sudo perl -MCPAN -e shell ... HTML::Parser is up to date (3.69).

        without sudo (below), 3.55 was returned with an error:

        $ perl -MDevel::Modlist -MWWW::Mechanize -e 1 HTML::Parser object version 3.55 does not match bootstrap parameter 3. +69 ...

        This sounds like two separate installations of Perl that are not in sync. I see you've added perl -V output below; what does sudo perl -V produce?

        -- Ken

      I was having a similar error with:
      Protocol scheme 'http' is not supported
      I had installed libwww-perl-6.04 on perl 5.8
      It was solved by installing libwww-perl-5.837
      -Jess

        G'day Jess,

        Welcome to the monastery.

        Thanks for the heads-up but I wasn't the one experiencing a problem. It looks like your reply was intended for ggerke: it can be moved, if you want.

        -- Ken

Re: Protocol scheme 'http' is not supported
by Anonymous Monk on Jul 28, 2012 at 00:00 UTC

    What do you have installed?

    Upgrade

    $ perl -MDevel::Modlist -MWWW::Mechanize -e 1 AutoLoader 5.72 Carp 1.25 Compress::Raw::Zlib 2.054 Compress::Zlib 2.052 Config Encode 2.44 Encode::Alias 2.15 Encode::Config 2.05 Encode::Encoding 2.05 Exporter 5.66 Exporter::Heavy 5.66 Fcntl 1.11 File::Glob 1.12 File::GlobMapper 1.000 File::Spec 3.33 File::Spec::Unix 3.33 File::Spec::Win32 3.33 HTML::Entities 3.69 HTML::Form 6.03 HTML::Parser 3.69 HTML::PullParser 3.57 HTML::Tagset 3.20 HTML::TokeParser 3.69 HTTP::Date 6.02 HTTP::Headers 6.00 HTTP::Message 6.03 HTTP::Request 6.00 HTTP::Response 6.03 HTTP::Status 6.03 IO 1.25_04 IO::Compress::Adapter::Deflate 2.052 IO::Compress::Base 2.052 IO::Compress::Base::Common 2.052 IO::Compress::Gzip 2.052 IO::Compress::Gzip::Constants 2.052 IO::Compress::RawDeflate 2.052 IO::Compress::Zlib::Extra 2.052 IO::File 1.15 IO::Handle 1.31 IO::Seekable 1.1 IO::Uncompress::Adapter::Inflate 2.052 IO::Uncompress::Base 2.052 IO::Uncompress::Gunzip 2.052 IO::Uncompress::RawInflate 2.052 LWP 6.04 LWP::MemberMixin LWP::Protocol 6.00 LWP::UserAgent 6.04 List::Util 1.25 Scalar::Util 1.25 SelectSaver 1.02 Storable 2.30 Symbol 1.07 Time::Local 1.2000 URI 1.60 URI::Escape 3.31 WWW::Mechanize 1.72 XSLoader 0.15 base 2.18 bytes 1.04 constant 1.21 feature 1.20 overload 1.13 utf8 1.09 vars 1.02 warnings 1.12 warnings::register 1.02
      Well, this is something new:
      $ perl -MDevel::Modlist -MWWW::Mechanize -e 1 HTML::Parser object version 3.55 does not match bootstrap parameter 3. +69 at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm +line 253. Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_ +64-linux-thread-multi/HTML/Entities.pm line 152. Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_ +64-linux-thread-multi/HTML/TokeParser.pm line 9. BEGIN failed--compilation aborted at /usr/lib64/perl5/site_perl/5.8.8/ +x86_64-linux-thread-multi/HTML/TokeParser.pm line 9. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/WWW/Me +chanize.pm line 134. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/WW +W/Mechanize.pm line 134. Compilation failed in require. BEGIN failed--compilation aborted. AutoLoader 5.60 Carp 1.26 Config DynaLoader 1.05 Encode 2.12 Encode::Alias 2.04 Encode::Config 2.01 Encode::Encoding 2.02 Exporter 5.58 Exporter::Heavy 5.58 Fcntl 1.05 HTML::Entities 3.69 HTML::Form 6.03 HTML::Parser 3.69 HTML::TokeParser HTTP::Date 6.02 HTTP::Headers 6.00 HTTP::Message 6.03 HTTP::Request 6.00 HTTP::Response 6.03 HTTP::Status 6.03 LWP 6.04 LWP::MemberMixin LWP::Protocol 6.00 LWP::UserAgent 6.04 Storable 2.30 Time::Local 1.11 URI 1.60 URI::Escape 3.31 WWW::Mechanize XSLoader 0.15 base 2.07 bytes 1.02 integer 1.00 overload 1.04 vars 1.01 warnings 1.05 warnings::register 1.01

      I checked my path and current directory to be sure I wasn't looking somewhere I didn't mean to be: $ echo $PATH

      /bin:/usr/bin:/sbin:/usr/sbin:/usr/5bin:/adm/bin:/opt/admin/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb:/opt/VRTS/bin $ $ ls usr/* ls: usr/*: No such file or directory $

      Thanks for your time looking...
        IIRC, we used to see something exactly similar (:-D) to this in a previous incarnation when attempting to run perl v5.10 against libraries (badly) pre-built and and installed for v5.8.

        Are you sure that you haven't got a similar situation whereby there's a mismatch between the perl version you're running and the version for/from which the library/ies were built and installed ?

        perl -V might well be of use since, amongst other things, it identifies the library locations perl is attempting to read.

        Just a thought ...

        A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://984098]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2015-01-29 23:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (244 votes), past polls