Acme-Throw
view release on metacpan or search on metacpan
lib/Acme/Throw.pm view on Meta::CPAN
die "something bad happened"
Alternatively,
perl -MAcme::Throw /path/to/program.pl
=head1 DESCRIPTION
B<THIS CODE IS CRAP! IT'S SO BAD IT MAKES THE I<COMPUTER> ANGRY!!!>
Do you feel that the error messages in your code don't express your
frustration with enough I<oomph>? Do screens full of stack dumps fill
you with a deep-seated rage?
Have you ever wanted to simply flip a table each time your program
dies with a cryptic, useless exception?
NOW YOU CAN.
=head1 THANKS
t/lib/Capture/Tiny.pm view on Meta::CPAN
$stash->{pos}{$_} = tell $stash->{capture}{$_};
# _debug("# will capture $_ on " . fileno($stash->{capture}{$_})."\n" );
_start_tee( $_ => $stash ) if $do_tee; # tees may change $stash->{new}
}
_wait_for_tees( $stash ) if $do_tee;
# finalize redirection
$stash->{new}{stderr} = $stash->{new}{stdout} if $do_merge;
# _debug( "# redirecting in parent ...\n" );
_open_std( $stash->{new} );
# execute user provided code
my ($exit_code, $inner_error, $outer_error, @result);
{
local *STDIN = *CT_ORIG_STDIN if $localize{stdin}; # get original, not proxy STDIN
# _debug( "# finalizing layers ...\n" );
_relayer(\*STDOUT, $layers{stdout}) if $do_stdout;
_relayer(\*STDERR, $layers{stderr}) if $do_stderr;
# _debug( "# running code $code ...\n" );
local $@;
eval { @result = $code->(); $inner_error = $@ };
$exit_code = $?; # save this for later
$outer_error = $@; # save this for later
}
# restore prior filehandles and shut down tees
# _debug( "# restoring filehandles ...\n" );
_open_std( $stash->{old} );
_close( $_ ) for values %{$stash->{old}}; # don't leak fds
# shouldn't need relayering originals, but see rt.perl.org #114404
_relayer(\*STDOUT, $layers{stdout}) if $do_stdout;
_relayer(\*STDERR, $layers{stderr}) if $do_stderr;
_unproxy( %proxy_std );
# _debug( "# killing tee subprocesses ...\n" ) if $do_tee;
t/lib/Capture/Tiny.pm view on Meta::CPAN
_relayer($stash->{capture}{$_}, $layers{$_});
$got{$_} = _slurp($_, $stash);
# _debug("# slurped " . length($got{$_}) . " bytes from $_\n");
}
print CT_ORIG_STDOUT $got{stdout}
if $do_stdout && $do_tee && $localize{stdout};
print CT_ORIG_STDERR $got{stderr}
if $do_stderr && $do_tee && $localize{stderr};
}
$? = $exit_code;
$@ = $inner_error if $inner_error;
die $outer_error if $outer_error;
# _debug( "# ending _capture_tee with (@_)...\n" );
return unless defined wantarray;
my @return;
push @return, $got{stdout} if $do_stdout;
push @return, $got{stderr} if $do_stderr && ! $do_merge;
push @return, @result;
return wantarray ? @return : $return[0];
}
1;
t/lib/Capture/Tiny.pm view on Meta::CPAN
=head2 Limited support for Perl 5.6
Perl 5.6 predates PerlIO. UTF-8 data may not be captured correctly.
=head1 ENVIRONMENT
=head2 PERL_CAPTURE_TINY_TIMEOUT
Capture::Tiny uses subprocesses for C<<< tee >>>. By default, Capture::Tiny will
timeout with an error if the subprocesses are not ready to receive data within
30 seconds (or whatever is the value of C<<< $Capture::Tiny::TIMEOUT >>>). An
alternate timeout may be specified by setting the C<<< PERL_CAPTURE_TINY_TIMEOUT >>>
environment variable. Setting it to zero will disable timeouts.
=head1 SEE ALSO
This module was, inspired by L<IO::CaptureOutput>, which provides
similar functionality without the ability to tee output and with more
complicated code and API. L<IO::CaptureOutput> does not handle layers
or most of the unusual cases described in the L</Limitations> section and
t/lib/IO/String.pm view on Meta::CPAN
sub blocking {
my $self = shift;
my $old = *$self->{blocking} || 0;
*$self->{blocking} = shift if @_;
return $old;
}
my $notmuch = sub { return };
*fileno = $notmuch;
*error = $notmuch;
*clearerr = $notmuch;
*sync = $notmuch;
*flush = $notmuch;
*setbuf = $notmuch;
*setvbuf = $notmuch;
*untaint = $notmuch;
*autoflush = $notmuch;
*fcntl = $notmuch;
*ioctl = $notmuch;
( run in 0.357 second using v1.01-cache-2.11-cpan-65fba6d93b7 )