Fandelem
02-22-2001, 05:28 PM
i have written a little iplogger cgi script, but instead of cut&pasting it into every other cgi script to log the ip address, how can i "call" it? ie. in another script, something like "call(~/cgi-bin/iplog.cgi)" or something like that.. i don't know ;o)
and i've seen &subroutine and subroutine() - can someone explain to me the difference between the two calls? (i assume they both call the function?)
and finally, what's the smallest way any of you have made $date show the correct date(and time)? here is mine (it is lengthy, that's the reason i ask)
# this will figure out the date
my (
$sec,
$min,
$hour,
$mday,
$mon,
$year,
$wday,
$date,
$time,
@days,
@months,
);
# Define arrays for the day of the week and month of the year. #
@days = ('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
@months = ('January','February','March','April','May','June' ,'July',
'August','September','October','November','Decembe r');
# Get the current time and format the hour, minutes and seconds. Add #
# 1900 to the year to get the full 4 digit year. #
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$time = sprintf("%02d.%02d.%02d",$hour,$min,$sec);
$year += 1900;
# Format the date. #
$date = "$days[$wday], $months[$mon] $mday, $year at $time";
and then from anywhere i can use $date
(i kinda modified/borrowed this from matt's formmail.pl script ;o) hehe
thanks for your replies.. =)
~kyle
and i've seen &subroutine and subroutine() - can someone explain to me the difference between the two calls? (i assume they both call the function?)
and finally, what's the smallest way any of you have made $date show the correct date(and time)? here is mine (it is lengthy, that's the reason i ask)
# this will figure out the date
my (
$sec,
$min,
$hour,
$mday,
$mon,
$year,
$wday,
$date,
$time,
@days,
@months,
);
# Define arrays for the day of the week and month of the year. #
@days = ('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
@months = ('January','February','March','April','May','June' ,'July',
'August','September','October','November','Decembe r');
# Get the current time and format the hour, minutes and seconds. Add #
# 1900 to the year to get the full 4 digit year. #
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$time = sprintf("%02d.%02d.%02d",$hour,$min,$sec);
$year += 1900;
# Format the date. #
$date = "$days[$wday], $months[$mon] $mday, $year at $time";
and then from anywhere i can use $date
(i kinda modified/borrowed this from matt's formmail.pl script ;o) hehe
thanks for your replies.. =)
~kyle