[H-GEN] How do I specify a path in a Perl program
Jason Henry Parker
jasonp at uq.net.au
Mon May 13 05:34:08 EDT 2002
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
s4565 at lycos.co.uk writes:
> 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.
The answer is right in front of you. The error message from Perl is
reporting the contents of the @INC array, which is a list of
directories searched for modules imported with the C<use> statement
(among others).
There are quite a few ways to change @INC, the most notable being the
perl -I option (see perldoc perlrun) or the C<lib> pragma (see
perldoc lib).
> 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
In your case you should add the
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux directory to @INC, I
believe. Something like this
use lib '/usr/lib/perl5/vendor_perl/5.6.1/i386-linux';
before the C<use> statement that imports HTML::Entities should do the
trick.
--
||----|---|------------|--|-------|------|-----------|-#---|-|--|------||
| "Noble sentiments require the delicate sting of an arrow |
| Not the rude bluntness of a two-by-four" jasonp at uq.net.au |
||--|--------|--------------|----|-------------|------|---------|-----|-|
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list