
FishMonger
Veteran
Apr 9, 2012, 12:02 PM
Post #6 of 6
(735 views)
|
|
Re: [naven8] How to print output to STDOUT
[In reply to]
|
Can't Post
|
|
The most important step when posting questions is to provide a clear and concise problem statement, which you have not done. However, I do get the basic gist of what you need. You'll want to start by using the caller function to get the context of the current subroutine call. http://perldoc.perl.org/functions/caller.html If you're not already doing so, you'll want to add a Debug flag and base the level of debug output on the value of that flag. The error output should go to STDERR, not STDOUT. If you need low level stack trace info, then use one of the Devel modules, such as Devel::StackTrace or Devel:CallerStack. http://search.cpan.org/~drolsky/Devel-StackTrace-1.27/lib/Devel/StackTrace.pm http://search.cpan.org/~exodist/Devel-CallerStack-0.003/lib/Devel/CallerStack.pm http://search.cpan.org/search?query=devel+stack&mode=all You may want to use one of the Tee modules that I previously linked to so you can use a single print statement to output the debug data to multiple filehandles.
|