PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [Perl] - Problem mit LWP



brain-death
28-11-2004, 19:41
Hallo,

wollte einwenig mit Perl rumspielen und habe folgendes probiert:


#!/usr/bin/perl -w
use LWP::UserAgent;
$url = 'http://www.google.de';
$agent = new LWP::UserAgent;
$request = HTTP::Request->new('GET', $url);
$result = $agent->request($request);

print $result->content();


Folgende Ausgabe:


500 Can't locate HTML/HeadParser.pm in @INC (@INC contains: /usr/lib/perl5/5.8.3/i586-linux-thread-multi /usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.3/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl .)


Also fehlt mir doch das Modul HTML::HeadParser
Also:


hagbard@leiferikson:~> su
Password:
leiferikson:/home/hagbard # cpan

cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support enabled

cpan> install HTML::HeadParser
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Sun, 28 Nov 2004 04:01:13 GMT
Running install for module HTML::HeadParser
Running make for G/GA/GAAS/HTML-Parser-3.38.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /root/.cpan/sources/authors/id/G/GA/GAAS/HTML-Parser-3.38.tar.gz ok
Scanning cache /root/.cpan/build for sizes
HTML-Parser-3.38/
HTML-Parser-3.38/t/
HTML-Parser-3.38/t/xml-mode.t
HTML-Parser-3.38/t/textarea.t
HTML-Parser-3.38/t/filter-methods.t
HTML-Parser-3.38/t/crashme.t
HTML-Parser-3.38/t/handler-eof.t
HTML-Parser-3.38/t/argspec-bad.t
HTML-Parser-3.38/t/dtext.t
HTML-Parser-3.38/t/callback.t
HTML-Parser-3.38/t/entities.t
HTML-Parser-3.38/t/argspec.t
HTML-Parser-3.38/t/comment.t
HTML-Parser-3.38/t/declaration.t
HTML-Parser-3.38/t/offset.t
HTML-Parser-3.38/t/handler.t
HTML-Parser-3.38/t/plaintext.t
HTML-Parser-3.38/t/case-sensitive.t
HTML-Parser-3.38/t/cases.t
HTML-Parser-3.38/t/marked-sect.t
HTML-Parser-3.38/t/filter.t
HTML-Parser-3.38/t/tokeparser.t
HTML-Parser-3.38/t/linkextor-rel.t
HTML-Parser-3.38/t/entities2.t
HTML-Parser-3.38/t/skipped-text.t
HTML-Parser-3.38/t/linkextor-base.t
HTML-Parser-3.38/t/default.t
HTML-Parser-3.38/t/headparser.t
HTML-Parser-3.38/t/uentities.t
HTML-Parser-3.38/t/headparser-http.t
HTML-Parser-3.38/t/stack-realloc.t
HTML-Parser-3.38/t/magic.t
HTML-Parser-3.38/t/options.t
HTML-Parser-3.38/t/attr-encoded.t
HTML-Parser-3.38/t/argspec2.t
HTML-Parser-3.38/t/ignore.t
HTML-Parser-3.38/t/largetags.t
HTML-Parser-3.38/t/unbroken-text.t
HTML-Parser-3.38/t/msie-compat.t
HTML-Parser-3.38/t/api_version.t
HTML-Parser-3.38/t/parsefile.t
HTML-Parser-3.38/t/parser.t
HTML-Parser-3.38/t/process.t
HTML-Parser-3.38/t/pullparser.t
HTML-Parser-3.38/eg/
HTML-Parser-3.38/eg/hlc
HTML-Parser-3.38/eg/hanchors
HTML-Parser-3.38/eg/htextsub
HTML-Parser-3.38/eg/htitle
HTML-Parser-3.38/eg/hstrip
HTML-Parser-3.38/eg/hrefsub
HTML-Parser-3.38/eg/hform
HTML-Parser-3.38/eg/hdump
HTML-Parser-3.38/eg/htext
HTML-Parser-3.38/lib/
HTML-Parser-3.38/lib/HTML/
HTML-Parser-3.38/lib/HTML/Entities.pm
HTML-Parser-3.38/lib/HTML/PullParser.pm
HTML-Parser-3.38/lib/HTML/Filter.pm
HTML-Parser-3.38/lib/HTML/TokeParser.pm
HTML-Parser-3.38/lib/HTML/LinkExtor.pm
HTML-Parser-3.38/lib/HTML/HeadParser.pm
HTML-Parser-3.38/util.c
HTML-Parser-3.38/Makefile.PL
HTML-Parser-3.38/hints/
HTML-Parser-3.38/hints/solaris.pl
HTML-Parser-3.38/Parser.pm
HTML-Parser-3.38/TODO
HTML-Parser-3.38/MANIFEST
HTML-Parser-3.38/tokenpos.h
HTML-Parser-3.38/Changes
HTML-Parser-3.38/mkhctype
HTML-Parser-3.38/Parser.xs
HTML-Parser-3.38/mkpfunc
HTML-Parser-3.38/hparser.c
HTML-Parser-3.38/README
HTML-Parser-3.38/hparser.h
HTML-Parser-3.38/typemap
Removing previously used /root/.cpan/build/HTML-Parser-3.38

CPAN.pm: Going to build G/GA/GAAS/HTML-Parser-3.38.tar.gz


Perl-5.8 provide core support for Unicode strings. You can compile
HTML::Entities so that Unicode entities like € and € are
decoded into a string containing "\x{20AC}". If you select no to
the question below such entities will be left alone and only entities
in the Latin-1 range is decoded.

Do you want decoding on unicode entities? [no]
Checking if your kit is complete...
Looks good
Writing Makefile for HTML::Parser
cp lib/HTML/PullParser.pm blib/lib/HTML/PullParser.pm
cp Parser.pm blib/lib/HTML/Parser.pm
cp lib/HTML/Entities.pm blib/lib/HTML/Entities.pm
cp lib/HTML/TokeParser.pm blib/lib/HTML/TokeParser.pm
cp lib/HTML/LinkExtor.pm blib/lib/HTML/LinkExtor.pm
cp lib/HTML/HeadParser.pm blib/lib/HTML/HeadParser.pm
cp lib/HTML/Filter.pm blib/lib/HTML/Filter.pm
/usr/bin/perl /usr/lib/perl5/5.8.3/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.3/ExtUtils/typemap -typemap typemap Parser.xs > Parser.xsc && mv Parser.xsc Parser.c
/usr/bin/perl mkhctype >hctype.h
/usr/bin/perl mkpfunc >pfunc.h
cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -Wall -pipe -DVERSION=\"3.38\" -DXS_VERSION=\"3.38\" -fPIC "-I/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE" -DMARKED_SECTION Parser.c
/bin/sh: line 1: cc: command not found
make: *** [Parser.o] Fehler 127
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>

Was kann ich jetzt machen, bzw. wo ist der Fehler?

ciao & danke

tictactux
29-11-2004, 02:14
> cc -c ...
> Parser.c
> /bin/sh: line 1: cc: command not found
> make: *** [Parser.o] Fehler 127

Was kann ich jetzt machen, bzw. wo ist der Fehler?

Steht doch da: installiere gcc
HTH
Wolfgang

brain-death
29-11-2004, 17:09
Steht doch da: installiere gcc
HTH
Wolfgang

Hab jetzt gcc 3.3.4. installiert, immer noch ein Fehler:


hagbard@leiferikson:~> su
Password:
leiferikson:/home/hagbard # cpan

cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support enabled

cpan> force install HTML::HeadParser
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Sun, 28 Nov 2004 04:01:13 GMT
Running install for module HTML::HeadParser
Running make for G/GA/GAAS/HTML-Parser-3.38.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /root/.cpan/sources/authors/id/G/GA/GAAS/HTML-Parser-3.38.tar.gz ok
Scanning cache /root/.cpan/build for sizes
HTML-Parser-3.38/
HTML-Parser-3.38/t/
HTML-Parser-3.38/t/xml-mode.t
HTML-Parser-3.38/t/textarea.t
HTML-Parser-3.38/t/filter-methods.t
HTML-Parser-3.38/t/crashme.t
HTML-Parser-3.38/t/handler-eof.t
HTML-Parser-3.38/t/argspec-bad.t
HTML-Parser-3.38/t/dtext.t
HTML-Parser-3.38/t/callback.t
HTML-Parser-3.38/t/entities.t
HTML-Parser-3.38/t/argspec.t
HTML-Parser-3.38/t/comment.t
HTML-Parser-3.38/t/declaration.t
HTML-Parser-3.38/t/offset.t
HTML-Parser-3.38/t/handler.t
HTML-Parser-3.38/t/plaintext.t
HTML-Parser-3.38/t/case-sensitive.t
HTML-Parser-3.38/t/cases.t
HTML-Parser-3.38/t/marked-sect.t
HTML-Parser-3.38/t/filter.t
HTML-Parser-3.38/t/tokeparser.t
HTML-Parser-3.38/t/linkextor-rel.t
HTML-Parser-3.38/t/entities2.t
HTML-Parser-3.38/t/skipped-text.t
HTML-Parser-3.38/t/linkextor-base.t
HTML-Parser-3.38/t/default.t
HTML-Parser-3.38/t/headparser.t
HTML-Parser-3.38/t/uentities.t
HTML-Parser-3.38/t/headparser-http.t
HTML-Parser-3.38/t/stack-realloc.t
HTML-Parser-3.38/t/magic.t
HTML-Parser-3.38/t/options.t
HTML-Parser-3.38/t/attr-encoded.t
HTML-Parser-3.38/t/argspec2.t
HTML-Parser-3.38/t/ignore.t
HTML-Parser-3.38/t/largetags.t
HTML-Parser-3.38/t/unbroken-text.t
HTML-Parser-3.38/t/msie-compat.t
HTML-Parser-3.38/t/api_version.t
HTML-Parser-3.38/t/parsefile.t
HTML-Parser-3.38/t/parser.t
HTML-Parser-3.38/t/process.t
HTML-Parser-3.38/t/pullparser.t
HTML-Parser-3.38/eg/
HTML-Parser-3.38/eg/hlc
HTML-Parser-3.38/eg/hanchors
HTML-Parser-3.38/eg/htextsub
HTML-Parser-3.38/eg/htitle
HTML-Parser-3.38/eg/hstrip
HTML-Parser-3.38/eg/hrefsub
HTML-Parser-3.38/eg/hform
HTML-Parser-3.38/eg/hdump
HTML-Parser-3.38/eg/htext
HTML-Parser-3.38/lib/
HTML-Parser-3.38/lib/HTML/
HTML-Parser-3.38/lib/HTML/Entities.pm
HTML-Parser-3.38/lib/HTML/PullParser.pm
HTML-Parser-3.38/lib/HTML/Filter.pm
HTML-Parser-3.38/lib/HTML/TokeParser.pm
HTML-Parser-3.38/lib/HTML/LinkExtor.pm
HTML-Parser-3.38/lib/HTML/HeadParser.pm
HTML-Parser-3.38/util.c
HTML-Parser-3.38/Makefile.PL
HTML-Parser-3.38/hints/
HTML-Parser-3.38/hints/solaris.pl
HTML-Parser-3.38/Parser.pm
HTML-Parser-3.38/TODO
HTML-Parser-3.38/MANIFEST
HTML-Parser-3.38/tokenpos.h
HTML-Parser-3.38/Changes
HTML-Parser-3.38/mkhctype
HTML-Parser-3.38/Parser.xs
HTML-Parser-3.38/mkpfunc
HTML-Parser-3.38/hparser.c
HTML-Parser-3.38/README
HTML-Parser-3.38/hparser.h
HTML-Parser-3.38/typemap
Removing previously used /root/.cpan/build/HTML-Parser-3.38

CPAN.pm: Going to build G/GA/GAAS/HTML-Parser-3.38.tar.gz


Perl-5.8 provide core support for Unicode strings. You can compile
HTML::Entities so that Unicode entities like € and € are
decoded into a string containing "\x{20AC}". If you select no to
the question below such entities will be left alone and only entities
in the Latin-1 range is decoded.

Do you want decoding on unicode entities? [no]
Checking if your kit is complete...
Looks good
Writing Makefile for HTML::Parser
cp lib/HTML/PullParser.pm blib/lib/HTML/PullParser.pm
cp Parser.pm blib/lib/HTML/Parser.pm
cp lib/HTML/Entities.pm blib/lib/HTML/Entities.pm
cp lib/HTML/TokeParser.pm blib/lib/HTML/TokeParser.pm
cp lib/HTML/LinkExtor.pm blib/lib/HTML/LinkExtor.pm
cp lib/HTML/HeadParser.pm blib/lib/HTML/HeadParser.pm
cp lib/HTML/Filter.pm blib/lib/HTML/Filter.pm
/usr/bin/perl /usr/lib/perl5/5.8.3/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.3/ExtUtils/typemap -typemap typemap Parser.xs > Parser.xsc && mv Parser.xsc Parser.c
/usr/bin/perl mkhctype >hctype.h
/usr/bin/perl mkpfunc >pfunc.h
cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -Wall -pipe -DVERSION=\"3.38\" -DXS_VERSION=\"3.38\" -fPIC "-I/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE" -DMARKED_SECTION Parser.c
/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE/patchlevel.h:121: warning: `local_patches' defined but not used
Running Mkbootstrap for HTML::Parser ()
chmod 644 Parser.bs
rm -f blib/arch/auto/HTML/Parser/Parser.so
LD_RUN_PATH="" cc -shared Parser.o -o blib/arch/auto/HTML/Parser/Parser.so
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/bin/ld: unrecognized option '--as-needed'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/HTML/Parser/Parser.so] Fehler 1
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>

tictactux
30-11-2004, 05:20
Dummerweise kennt der Linker (ld) die Option --as-needed nicht.
Ob die gcc-Version zu neu ist, oder ob der Linker von SuSE die Ursache ist,
kann ich nicht erkennen (bei mir läuft Debian).

Ich würde mir im Quellcode des Pakets das Makefile ansehen (ob dieses
--as-needed als Linker-Option setzt), und es da rausnehmen.
Vielleicht sagt die Paket-Dokumentation etwas zur erwarteten gcc-Version ?

HTH
Wolfgang