[H-GEN] How do I specify a path in a Perl program

Ben Fowler fowlerb at optushome.com.au
Mon May 13 05:39:19 EDT 2002

> Hi
> I am trying to run a perl program which has in it
> use HTML::Entities ();
> only when I go to run the perl program I get
> [tony at ringo FetchYahoo]$ ./fetchyahoo.pl --help
> Can't locate HTML/Entities.pm in @INC (@INC contains:
> /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1
> /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1
> /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
> /usr/lib/perl5/site_perl .) at ./fetchyahoo.pl line 40.
> BEGIN failed--compilation aborted at ./fetchyahoo.pl line 40.
> I have HTML/Entities.pm on my system
> [root at ringo rpms]# ls -l
> /usr/lib/perl5/vendor_perl/5.6.1/i386-linux/HTML/Entities.pm -r--r--r--    1 root     root        11359 Nov  6  2001 /usr/lib/perl5/vendor_perl/5.6.1/i386-linux/HTML/Entities.pm
> [root at ringo rpms]# 
> Question:  How do I tell the perl program I want to run where
> HTML::Entities is?

Try putting:

use lib '/usr/lib/perl5/vendor_perl/5.6.1/i386-linux';

after the "#!/usr/bin/perl" line, and before everything else on a line
by itself.

and see what happens.  As far as I can tell, the Perl package system
works vaugely like Java; directories/files correspond roughly to package
names, e.g. HTML::Entities would be HTML/Entities.pm below some
directory holding a bunch of Perl packages.  That path goes into the
"use lib" directive.



Ben Fowler, email: <ben.fowler at humbug.org.au> pgp/gpg key id: FFDE6AF7
  vanity web page: <http://azure.humbug.org.au/~zuul/>

                      "Who now remembers the Armenians?" -- Adolf Hitler
                                   (see http://groong.usc.edu/fisk.html)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: This is a digitally signed message part
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20020513/b2188daf/attachment.sig>

More information about the General mailing list