Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

When I run this command:


I get the error:

Can't locate Time/ 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 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 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


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

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

share|improve this question

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.

share|improve this answer

You must log in to answer this question.

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