[dancer-users] Capture or redirect STDOUT
igor.bujna at post.cz
igor.bujna at post.cz
Wed Feb 13 16:59:14 GMT 2013
Hi,
i want to capture STDOUT under my Dancer applications with package Capture::
Tiny. I have this simple Perl test:
----------------------------------------------------------------------------
----------------------------
use Capture::Tiny;
my ($stdout, $stderr, $exit) = Capture::Tiny::capture {
system( "echo 'OK'");
};
print STDERR "Captured:$stdout\n";
----------------------------------------------------------------------------
----------------------------
Capturing STDOUT in this script is ok, but when i move to Dancer app, that
this faill. System print command to STDERR and nothing is captured.
----------------------------------------------------------------------------
----------------------------
package Test;
use Dancer ':syntax';
use Capture::Tiny;
our $VERSION = '0.1';
get '/' => sub {
my ($stdout, $stderr, $exit) = Capture::Tiny::capture {
system( "echo 'OK'");
};
print STDERR "Captired:$stdout\n";
template 'index';
};
true;
----------------------------------------------------------------------------
----------------------------
Why or where system/fork redirect STDOUT to STDERR ? How can I capture this
under dancer. Maybe it will be possible to change system() call to own
function, where can use IPC::Open3, but how can i made it?
Thank you for yours suggestion Igor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130213/8e4b94ba/attachment.htm>
More information about the dancer-users
mailing list