http://www.perlmonks.org?node_id=984186


in reply to Re: Protocol scheme 'http' is not supported
in thread Protocol scheme 'http' is not supported

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...?

Replies are listed 'Best First'.
Re^3: Protocol scheme 'http' is not supported
by kcott (Archbishop) on Jul 28, 2012 at 17:04 UTC

    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

      Thanks for looking - obviously my eyes are missing something. I did the following but came up empty...
      $ sudo perl -V > sudoV.txt $ perl -V > V.txt $ diff V.txt sudoV.txt $
      but here's the sudo perl -V output:
      sudo perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.18-274.12.1.el5, archname=x86_64-linux-th +read-multi uname='linux x86-003.build.bos.redhat.com 2.6.18-274.12.1.el5 #1 s +mp tue nov 8 21:37:35 est 2011 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOU +RCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 - +mtune=generic -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root +@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dpref +ix=/usr -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/li +b/perl5/5.8.8 -Dsitelib=/usr/lib/perl5/site_perl/5.8.8 -Dvendorlib=/u +sr/lib/perl5/vendor_perl/5.8.8 -Darchlib=/usr/lib64/perl5/5.8.8/x86_6 +4-linux-thread-multi -Dsitearch=/usr/lib64/perl5/site_perl/5.8.8/x86_ +64-linux-thread-multi -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.8 +/x86_64-linux-thread-multi -Darchname=x86_64-linux-thread-multi -Dven +dorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithre +ads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_g +dbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinpe +rl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_get +hostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_end +protoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_s +etservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/u +sr/bin' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasin +g -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFI +LE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions +-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -W +declaration-after-statement -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-50)', gcco +sandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags ='' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread +-lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - +Wl,-rpath,/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_F +ORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-siz +e=4 -m64 -mtune=generic' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Dec 16 2011 08:20:05 @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 .
      I went to see where perl is installed in my path but only found the what I was expecting to find...
      $ whereis perl perl: /usr/bin/perl /usr/local/bin/perl /opt/admin/bin/perl /usr/share +/man/man1/perl.1.gz $ sudo whereis perl perl: /usr/bin/perl /usr/local/bin/perl /opt/admin/bin/perl /usr/share +/man/man1/perl.1.gz $ ls -l /usr/bin/perl /usr/local/bin/perl /opt/admin/bin/perl lrwxrwxrwx 1 root root 13 Apr 10 16:38 /opt/admin/bin/perl -> /usr/ +bin/perl -rwxr-xr-x 2 root root 19208 Dec 16 2011 /usr/bin/perl lrwxrwxrwx 1 root root 13 Apr 27 14:01 /usr/local/bin/perl -> /usr/ +bin/perl
        Hi,

        It does actually look like you have two perls installed.

        Look at your whereis output, /usr/bin/perl vs /usr/local/bin/perl

        You can verify this further by doing /usr/bin/perl -V and /usr/local/bin/perl -V

        I had a similar problem after a release-upgrade on my ubuntu-server.
        Unfortunately my only solution was to reinstall the system.

        Best regards,
        Jimmy