-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can not catch STDOUT, STDERR when \&code died #34
Comments
Capture::Tiny is designed to capture. Exception handling is an orthogonal concern that won't be included. You can already include any exception handling you want inside the capture block:
|
You do not understand. I do not ask to do exception handling. I ask to change format of calling. This change allow 'capture' even in case when code is died. Let compare: VS use Try::Tiny; Second is crazy code in compare with first. Also in case I sugeest to you. Module API is going to be more clear. Just one method VS three |
Certainly, at this point the API will not change. In your second code example, the try/catch are pointless, as I don't understand what you think would be different with capture variables passed as arguments. |
program OUTPUT is:
See difference? =)
I ask to extend API. Your capture_* you can leave forever or maybe in far future start long deprecation period.
Of course I want to do something with $stdout. And I will do. This is more sensitive in web based applications where I need to know and analize what is already sent to STDOUT before exception occour. |
It's not documented, but
How is that? |
Allow capturing when &code
This will never catch "YES"
my ( $stdout, $stderr, $result ) = capture { print "YES"; die; 1; };
Allow structure like:
my ( $stdout, $stderr );
my $result = capture { print "YES"; die; } $stdout, $stderr;
So I always have captured $stdout and $stderr
Also this allow to kill useless capture_* because of:
my $result = capture { print "YES"; die; } $stdout;
my $result = capture { print "YES"; die; } undef, $stderr;
my $result = capture { print "YES"; die; } $merged, $merged;
About $merged:
inside 'capture' you can check that $stdout == $stderr so it is $merged
The text was updated successfully, but these errors were encountered: