[prog] @INC in Perl

David Sumbler david at aeolia.co.uk
Mon Apr 26 20:33:39 EST 2004


On Mon, 26 Apr 2004, Dominik Schramm wrote:

> David Sumbler <david at aeolia.co.uk> wrote:
>
> > In a bash script, I have used the command 'lwp-request' to get the
> > contents of a web-page.  This works fine.
> >
> > But if I add the option '-o text', I get this error message:
> >
> > Can't locate HTML/Parse.pm in @INC (@INC contains:
> > [...]
> > I imagine that I need to add this directory to @INC.  How do I do
> > this?  (Sorry, I'm not familiar with Perl.)
>
> I doubt that you need to add a directory manually. Chances are
> that HTML::Parse is really not installed. It's not part of libwww-net,
> see this list of libwww components:
> http://cpan.uwinnipeg.ca/dist/libwww-perl

I wasn't sure that this was the problem - so far as I could see it is
already installed.

'rpm -qa | grep perl' gives:

perl-XML-Dumper-0.4-25
perl-HTML-Tagset-3.03-28
perl-XML-Encoding-1.01-23
perl-libxml-enno-1.02-29
perl-URI-1.21-7
perl-Filter-1.29-8
perl-Parse-Yapp-1.05-30
perl-libxml-perl-0.07-28
perl-5.8.3-16
perl-SGMLSpm-1.03ii-12
perl-XML-Parser-2.31-16
perl-DateManip-5.40-30
perl-libwww-perl-5.65-6
perl-HTML-Parser-3.26-18

'rpm -ql perl-HTML-Parser-3.26-18' gives:

/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/Entities.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/Filter.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/HeadParser.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/LinkExtor.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/Parser.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/PullParser.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/TokeParser.pm
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/HTML
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/HTML/Parser/Parser.bs
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/HTML/Parser/Parser.so
/usr/share/man/man3/HTML::Entities.3pm.gz
/usr/share/man/man3/HTML::Filter.3pm.gz
/usr/share/man/man3/HTML::HeadParser.3pm.gz
/usr/share/man/man3/HTML::LinkExtor.3pm.gz
/usr/share/man/man3/HTML::Parser.3pm.gz
/usr/share/man/man3/HTML::PullParser.3pm.gz
/usr/share/man/man3/HTML::TokeParser.3pm.gz

Looking at this, and the original error message, it seemed to my
inexpert eye that the problem is that the file being looked for is
HTML/Parse.pm, whereas the file that actually exists is called
HTML/Parser.pm .  So I tried making a symbolic link 'Parse.pm'
pointing to 'Parser.pm'.  When I ran my embryonic script again, the
original error message had disappeared, but I got a whole lot of other
errors (29 lines).

What on earth is going on, I thought?  Is lwp-request hopelessly
broken?  Since the man page is in section 1 of the manual, I would
have expected it to work as described from the command line.

> To install this module, do (as root):
>
> # perl -MCPAN -e 'install HTML::Parse'

So I tried what you suggested.  After going through all the questions,
things whirred away for a short while, and I finally got:

HTML::Parse is up to date.

But when I run my script (with the -o option for lwp-request) I still
get my original error message.  Very frustrating, when all I want to
do is to convert HTML to plain text, which sounds easy!

David

-- 


More information about the Programming mailing list