Perl Error (262 Views)
Reply
Regular Advisor
Ricardo Bassoi
Posts: 177
Registered: ‎07-31-2001
Message 1 of 10 (262 Views)
Accepted Solution

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
Honored Contributor
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 2 of 10 (262 Views)

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
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 3 of 10 (262 Views)

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
Ricardo Bassoi
Posts: 177
Registered: ‎07-31-2001
Message 4 of 10 (262 Views)

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
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 5 of 10 (262 Views)

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
Ricardo Bassoi
Posts: 177
Registered: ‎07-31-2001
Message 6 of 10 (262 Views)

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
Manolo Hensel Cores
Posts: 1
Registered: ‎01-16-2002
Message 7 of 10 (262 Views)

Re: Perl Error


Hi Ricardo,

Try to use the Shell lib.
Honored Contributor
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 8 of 10 (262 Views)

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
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 9 of 10 (262 Views)

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
Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 10 of 10 (262 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.