Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl installation on Win32

Status
Not open for further replies.

JJ1

Programmer
Joined
Apr 19, 2001
Messages
104
Location
GB
Hi All,

I need to use "Time::Local" functions such as timelocal(..) and I also need the time() funtion and cgi.

This is because I have a script written for UNIX, but I need to move it to an NT server.

The problem is, which perl modules for ActivePerl do I need to use these functions/modules? Where can I download them from?

Any help would be much appreciated.

James.

 
Hi James,

If the modules you need aren't part of the standard distribution you can get them on one of two places:

1 - Use the Perl Package Manager (ppm) to automatically download and install the modules you need.

From the command line, and with your PATH set to include the perl bin directory, type:

ppm
install Time::Local
quit

If the package is available it will be installed automatically, otherwise...

2 - Manually download and install the packages from
This isn't as bad as it sounds usually, especially for pure perl modules that don't need any compilation. The instructions will be with the modules you need. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Mike,

Thank you very much for the help. I haven't tried the PPM method yet, but from the ActivePerl website, I have found several time-related PPM's.

How come they have names like "UNIX-time" and not UNIX::time? Do PPM's contain lots of modules? Does this mean that "UNIX-time" could (if I'm lucky!) contain the time::local module??

i.e. When you type "install x::y" do you specify the module name or the PPM name when you fill in the x::y parameter?

One last question...do you know how to return the current time as the number of seconds since 1st January 1970 (aka the UNIX epoch)? In UNIX, this is achieved with the command time(), but I need to know how to do it with Windows Active State perl.

Thank you for your time,

James.

 
Hi James,

time returns the number of non-leap seconds from the epoch (jan 1 1970)

localtime() returns a nine element list of integers
my ($sec, $min, $hour, $daymonth, $month, $year, $weekday, $yearday, $isdst) = localtime();

$year = $year - 1900
$weekday (0-6)
$month (0-11)


As far as I know these are standard distribution functions

HTH

Regards
P
 
Hi Paul,

Thanks for lettting me know...I didn't realise the time() function came as standard with Active State Perl on Windows.

Have you ever heard of a function called timelocal() in Windows? - this does the inverse of localtime and comes with the time::local module on UNIX.

P.S. I think it's about time I got Active State installed on our webserer and checked this out for myself!

Thanks again,

James.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top