Showing results for 
Search instead for 
Do you mean 

Perl Error

SOLVED
Go to Solution
Regular Advisor Regular Advisor

Perl Error

Hi Everybody,

I??m a beginner at Perl and trying to do a dumb sript ( using shell commands ) only for test.
I got a crab message:
Can't locate shell.pm in @INC (@INC contains: /opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi
/opt/perl/lib/5.6.1 /opt/perl/lib/site_perl/5.6.1/PA-RISC1.1-thread-multi
/opt/perl/lib/site_perl/5.6.1 /opt/perl/lib/site_perl .) at ./ola line 2.
BEGIN failed--compilation aborted at ./ola line 2.
Somebody has an idea ?
The script is in the attachment.

Tks.



If you never try, never will work
1 ACCEPTED SOLUTION
Honored Contributor Honored Contributor

Re: Perl Error

Find out where they are:

find / -type f -name "[Ss]hell.pm"

then you will need the Config.pm, so find it:

find / -type f -name "[Cc]onfig.pm"

Now, set your PERL5LIB path variable:

export PERL5LIB=/pathesfoundabove:/maybeanotherpath

like I have:


export PERL5LIB=/usr/local/lib/perl5:/usr/local/lib/perl5.004


live free or die
harry
Live Free or Die
9 REPLIES
Honored Contributor Honored Contributor

Re: Perl Error

Find out where they are:

find / -type f -name "[Ss]hell.pm"

then you will need the Config.pm, so find it:

find / -type f -name "[Cc]onfig.pm"

Now, set your PERL5LIB path variable:

export PERL5LIB=/pathesfoundabove:/maybeanotherpath

like I have:


export PERL5LIB=/usr/local/lib/perl5:/usr/local/lib/perl5.004


live free or die
harry
Live Free or Die
Honored Contributor Honored Contributor

Re: Perl Error


I forgot to add, that you need to capitalize it!

use Shell;


live free or die
harry
Live Free or Die
Regular Advisor Regular Advisor

Re: Perl Error


Hi Harry,

Tks man !

I did what you told me and it works. The problem now is only the following:
How to right execute shell commands inside a Perl script, like the simple DATE command ?
I tried but no way !
If you never try, never will work
Honored Contributor Honored Contributor

Re: Perl Error

You don't need shell for that:

#!/usr/local/bin/perl
#
$dah=`date`; #notice tic marks
printf $dah;


live free or die
harry
Live Free or Die
Regular Advisor Regular Advisor

Re: Perl Error


Harry,

For sure that for that I dont need the shell. But sometimes its necessary like a FTP, TELNET or other shell interaction.
How to do in this way ?

Tks
If you never try, never will work
Occasional Visitor

Re: Perl Error


Hi Ricardo,

Try to use the Shell lib.
Honored Contributor Honored Contributor

Re: Perl Error

Ricardo,

I wish Clay or JRF would respond, because one of them uses perl to FTP, using the FTP perl modules. Hopefully they will :-??

live free or die
harry
Live Free or Die
Honored Contributor Honored Contributor

Re: Perl Error

Ricardo,

Here you will find Clay's ftp using perl example:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc88106295e00d6118ff40090279cd0f9,00.html

And for telnet:
http://www.perlfect.com/articles/telnet.shtml


live free or die
harry
Live Free or Die
Highlighted
Acclaimed Contributor Acclaimed Contributor

Re: Perl Error

Hi Ricardo:

Since Harry has already posted a link to one of my FTP examples the only thing left to emphasize is that the Net::FTP module is not a part of bundled Perl but must be downloaded and installed from http://www.perl.org/CPAN.
I will add one other comment from my teeny-tiny Perl knowledge and that is the the Shell module is seldom used. There's nothing wrong with it; it's just that there are generally better ways to do it within Perl.

If you don't already have them you really need to purchase the O'Reilly Perl books; the learning curve for perl is rather steep because the language is so rich.

Regards, Clay
If it ain't broke, I can fix that.