Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

fatal error: Can't locate time/Local.pm in @INC...

Quote Reply
fatal error: Can't locate time/Local.pm in @INC...
Hi all,
I am reinstalling the Links 2.0 script into another server. Unfortunately I am finding that this server is not accepting certain variables in the Links.cfg

I have no problems with Adding New Categories,
Unfortunately when trying to add a new link I get the following server message.

CGI ERROR
==========================================
Error Message : fatal error: Can't locate time/Local.pm in @INC (@INC contains: /usr/local/etc/httpd/cgi-bin/admin /usr/local/lib/perl5/5.00503/i386-bsdos /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-bsdos /usr/local/lib/perl5/site_perl/5.005 .) at /usr/local/etc/httpd/cgi-bin/admin/links.cfg line 160.

Script Location : /usr/local/etc/httpd/cgi-bin/admin/admin.cgi
Perl Version : 5.00503

I have made no changes to the links.cfg script related to times or dates.
Links.cfg is also located in the admin directory with the links.cgi.


Please let me know what I should do to correct the error.... the likely piece of the links.cfg file is


# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";

NOTE The server is unix using a Virtual Server
Operating System v6.0.0

Appreciate any assistance


Quote Reply
Re: fatal error: Can't locate time/Local.pm in @INC... In reply to
Your hosting company needs to upgrade their Perl modules to include the Local.pm module OR you can download Local.pm (including all associated like Time) from http://www.cpan.org/..then upload the module into the same directory where your links.cfg file is located.

Then change the following line of code in the sub date_to_unix routine:

Code:

require Time::Local;


to the following:

Code:

use Time::Local;


Regards,


Eliot Lee
Quote Reply
Re: fatal error: Can't locate time/Local.pm in @INC... In reply to
Antrho,

Appreciate your advise but unfortunately after half a day of trying to locate a Local.pm module im lost. Cpan doesnt have a "Local.pm" so ive figured it must be part of another module. Would you know the name of the module I should be looking for??

Appreciate again your assistance.

Kami

Quote Reply
Re: fatal error: Can't locate time/Local.pm in @INC... In reply to
I would recommend contacting your hosting company first and ask them to FULLY upgrade their Perl package.

BTW: The module you need from http://www.cpan.org/ IF your hosting company cannot help you is the following:

http://search.cpan.org/...03/lib/Time/Local.pm

BTW: I found this module by going to the SEARCH CPAN site located at http://search.cpan.org/, which is PLAINLY linked at the bottom of the CPAN homepage!

Regards,

Eliot Lee
Quote Reply
Re: [Stealth] fatal error: Can't locate time/Local.pm in @INC... In reply to
I applied the posted changes to my links.cfg but keep getting the same error of:

  • Date (Invalid date format)


  • What is next step for troubleshooting?
    Quote Reply
    Re: [felicin] fatal error: Can't locate time/Local.pm in @INC... In reply to
    Here's the trouble-shooting steps I took to correct the problem.

    My original links.cfg contained translation of the dates in Spanish, but it seem to work fine throughout the last year (2002). For some unknown reason on 2003, it started giving the "INVALID DATE FORMAT" error.

    So, I proceeded to download an original copy of links.cfg and replaced the previous one.

    This got rid of the invalid date format error.
    Quote Reply
    Re: [felicin] fatal error: Can't locate time/Local.pm in @INC... In reply to
    Glad you figured it out.

    Although I did recommend using the original LINKS.CFG in the follwing post:

    http://www.gossamer-threads.com/...;;page=unread#unread
    ========================================
    Buh Bye!

    Cheers,
    Me