1

I have a Perl program named /usr/bin/octbatch running as a script on Fedora 17 Linux.

When I run this command:

/usr/bin/octbatch

I get the error:

Can't locate Time/Piece.pm in @INC (@INC contains: 
/usr/local/lib64/perl5 /usr/local/share/perl5 
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl 
/usr/lib64/perl5 /usr/share/perl5) at /usr/bin/octbatch line 6.
BEGIN failed--compilation aborted at /usr/bin/octbatch line 6.

Here is the relevant lines of the Perl script:

#!/usr/bin/perl -wT

$ENV{PATH} = "/bin:/usr/bin:/usr/local/bin";
use strict;
use POSIX qw(setsid :sys_wait_h);

use Time::Piece;
use Time::Local;

I have to install Piece.pm so perl can find it. I've already installed it with this command (using the defaults):

/usr/bin/perl -MCPAN -e install Time::Piece

I have the Piece.pm file in /home/el/perl5/lib/perl5/x86_64-linux-thread-multi/ however when I run the octbatch command I get the same error as above. Like it can't even find it.

Here is my PERL5LIB variable:

el@defiant ~/gnuoctbluehost/single_stock_analysis $ env | grep PERL5

PERL5LIB=/home/el/perl5/lib/perl5/x86_64-linux-thread-multi:/home/el/perl5/lib/perl5

And the Piece.pm is located under /home/el/perl5/lib/perl5/x86_64-linux-thread-multi

So my question is, Why is it not finding my Piece.pm file? And what are the ways I can get the @INC variable to include it. Or how do I make perl see it?

1 Answer 1

2

Fedora 17 include Time::Piece

Use the command: yum install perl-Time-Piece

You can find that out with google search: fedora 17 Time-Piece and hit the first link.

Work around to manually include the path and library:

Make sure the following line is before use Time::Piece; but after #!/usr/bin/perl -wT.

use lib "/home/el/perl5/lib/perl5/x86_64-linux-thread-multi";

Which tells my perl program where to look for Time::Piece. Then the program works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .