Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Log Files for CGI Submits

by AltBlue (Chaplain)
on Jul 23, 2008 at 21:06 UTC ( [id://699702]=note: print w/replies, xml ) Need Help??


in reply to Log Files for CGI Submits

You could be lazy and (ab)use File::Temp:
#!/usr/bin/perl use strict; use warnings; use POSIX (); use File::Temp (); my $log = File::Temp->new( UNLINK => 0, DIR => '/the/path/to/your/log/folder/', # isn't this too fancy?! you don't need "nice" file names* ;-) TEMPLATE => POSIX::strftime( 'simplebr_%Y%m%d%H%M%S_XXXX', localti +me ), SUFFIX => '.txt', ); print $log 'foo bar'; close $log;
* I guess your "logs" folder is in fact some kind of (very) poor man's queue. If this is correct, you don't want to *sort* those files on a file name basis because it would be too slow, better use whatever your underlying OS offers you for watching a folder (e.g. Sys::Gamin, Linux::Inotify, SGI::FAM, Win32::ChangeNotify). Anyway, you'll have to take some solid countermeasures in order to avoid trashing your disk. ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-06-24 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.