D'oh - Debug module
#!/usr/bin/perl -w use D'oh; D'oh::stderr(); D'oh::stderr('/tmp/stderr'); #print date and script name/pid to STDERR D'oh::date(); #redirect STDOUT D'oh::stdout(); D'oh::stdout('/tmp/stdout'); D'oh::date('STDOUT'); print "hellloooooo\n"; die "world"; __END__ tail /tmp/stdout #===== myscript [1743]: Mon Feb 2 11:27:41 1998 =====# hellloooooo tail /tmp/stderr #===== myscript [1743]: Wed Apr 1 11:24:39 1998 =====# # world. File '/export/home/chrisn/bin/myscript'; Line 15
The module, when used, prints all STDERR (or STDOUT) to a given file, which is by default /tmp/D'oh.
STDERR
STDOUT
/tmp/D'oh
Also, multiple scripts can write simultaneously to the same error file, making it really messy. If you don't like this, then select different files for each script or whatever.
Mac OS does not like to have multiple opens to the same file. Use different files. The default directory for the files is $ENV{TMPDIR} in MacPerl, not /tmp.
$ENV{TMPDIR}
/tmp
Chris Nandor, pudge@pobox.com, http://pudge.net/
Copyright (c) 1998 Chris Nandor. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Version 0.05 (02 February 1998)
To install D::oh, copy and paste the appropriate command in to your terminal.
cpanm
cpanm D::oh
CPAN shell
perl -MCPAN -e shell install D::oh
For more information on module installation, please visit the detailed CPAN module installation guide.