Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How can I timestamp each printed statement?

by Roy Johnson (Monsignor)
on Mar 06, 2008 at 19:09 UTC ( [id://672544]=note: print w/replies, xml ) Need Help??


in reply to How can I timestamp each printed statement?

There are a whole bunch of logging modules on CPAN. Log::Dynamic looks suitable to my undiscerning eye.

Update: You can get the effect you want — having $now implicitly call localtime — by tie-ing it:

package Now; require Tie::Scalar; our @ISA = qw(Tie::StdScalar); sub FETCH {scalar localtime} package main; tie my $now, 'Now'; print "The time is $now\n"; sleep 3; print "The time is $now\n";
It's probably not what you really want to do, though.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: How can I timestamp each printed statement?
by johnnybongo (Initiate) on Mar 06, 2008 at 19:43 UTC
    THANK YOU VERY MUCH!!! That is doing just what I needed it to. Now each line item of my output that contains $now is returning an accurate timestamp for that action. Thanks again for the quick and useful response!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://672544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found