App-cpantimes
view release on metacpan or search on metacpan
=item L<HTTP::Tiny> Copyright 2011 Christian Hansen
=item L<Module::Metadata> Copyright 2001-2006 Ken Williams. 2010 Matt S Trout
=item L<version> Copyright 2004-2010 John Peacock
=item L<JSON::PP> Copyright 2007â2011 by Makamaka Hannyaharamitu
=item L<CPAN::Meta> Copyright (c) 2010 by David Golden and Ricardo Signes
=item L<Try::Tiny> Copyright (c) 2009 Yuval Kogman
=item L<parent> Copyright (c) 2007-10 Max Maischein
=item L<Version::Requirements> copyright (c) 2010 by Ricardo Signes
=item L<CPAN::Meta::YAML> copyright (c) 2010 by Adam Kennedy
=back
=head1 LICENSE
or die CPAN::Meta::YAML->errstr;
}
1;
__END__
PARSE_CPAN_META
$fatpacked{"Try/Tiny.pm"} = <<'TRY_TINY';
package Try::Tiny;
use strict;
#use warnings;
use vars qw(@EXPORT @EXPORT_OK $VERSION @ISA);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
}
my ( $catch, @finally );
# find labeled blocks in the argument list.
# catch and finally tag the blocks by blessing a scalar reference to them.
foreach my $code_ref (@code_refs) {
next unless $code_ref;
my $ref = ref($code_ref);
if ( $ref eq 'Try::Tiny::Catch' ) {
$catch = ${$code_ref};
} elsif ( $ref eq 'Try::Tiny::Finally' ) {
push @finally, ${$code_ref};
} else {
use Carp;
confess("Unknown code ref type given '${ref}'. Check your usage & try again");
}
}
# save the value of $@ so we can set $@ back to it in the beginning of the eval
my $prev_error = $@;
return 1; # properly set $fail to false
};
# copy $@ to $error; when we leave this scope, local $@ will revert $@
# back to its previous value
$error = $@;
}
# set up a scope guard to invoke the finally block at the end
my @guards =
map { Try::Tiny::ScopeGuard->_new($_, $failed ? $error : ()) }
@finally;
# at this point $failed contains a true value if the eval died, even if some
# destructor overwrote $@ as the eval was unwinding.
if ( $failed ) {
# if we got an error, invoke the catch block.
if ( $catch ) {
# This works like given($error), but is backwards compatible and
# sets $_ in the dynamic scope for the body of C<$catch>
for ($error) {
} else {
# no failure, $@ is back to what it was, everything is fine
return $wantarray ? @ret : $ret[0];
}
}
sub catch (&;@) {
my ( $block, @rest ) = @_;
return (
bless(\$block, 'Try::Tiny::Catch'),
@rest,
);
}
sub finally (&;@) {
my ( $block, @rest ) = @_;
return (
bless(\$block, 'Try::Tiny::Finally'),
@rest,
);
}
{
package # hide from PAUSE
Try::Tiny::ScopeGuard;
sub _new {
shift;
bless [ @_ ];
}
sub DESTROY {
my @guts = @{ shift() };
my $code = shift @guts;
$code->(@guts);
lib/App/cpantimes.pm view on Meta::CPAN
=item L<HTTP::Tiny> Copyright 2011 Christian Hansen
=item L<Module::Metadata> Copyright 2001-2006 Ken Williams. 2010 Matt S Trout
=item L<version> Copyright 2004-2010 John Peacock
=item L<JSON::PP> Copyright 2007â2011 by Makamaka Hannyaharamitu
=item L<CPAN::Meta> Copyright (c) 2010 by David Golden and Ricardo Signes
=item L<Try::Tiny> Copyright (c) 2009 Yuval Kogman
=item L<parent> Copyright (c) 2007-10 Max Maischein
=item L<Version::Requirements> copyright (c) 2010 by Ricardo Signes
=item L<CPAN::Meta::YAML> copyright (c) 2010 by Adam Kennedy
=back
=head1 LICENSE
( run in 0.741 second using v1.01-cache-2.11-cpan-05444aca049 )