[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] WWWBoard and MacPerl



|At 14:32 -0500 98/08/25, Marcel Brown wrote:
|> it looks like I'll be fine except for one thing I'm not sure of. In the
|> variable definition section, it has this line:
|> $date_command = "/bin/date";
|I suggest you translate the code to "native" perl.  Try:
|  $date_command = localtime();

While the suggestion is good, the implementation isn't. Note that
$date_command is the *command to get the date*, not the date itself.
Also, /bin/date outputs a newline at the end of the date while localtime
doesn't. Presumably somewhere (or multiple somewhere's if you're unlucky),
there's some code like:

$timestamp = `$date_command`;

or maybe:

system $date_command;

if STDOUT is the log file. These are what need to be changed to:

$timestamp = localtime . "\n";

or

print scalar localtime, "\n";

This is assuming the dates don't need to be bit-for-bit compatible. As
Vicki notes localtime and /bin/date don't have precisely the same output,
but for a timestamp in a log, localtime should be sufficient (unless
another script is analyzing the log, in which case it might expect
/bin/date's format).

Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch