diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/autodie.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/autodie.pm | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/Master/tlpkg/tlperl/lib/autodie.pm b/Master/tlpkg/tlperl/lib/autodie.pm index 5934c138ed0..8f62d670d80 100644 --- a/Master/tlpkg/tlperl/lib/autodie.pm +++ b/Master/tlpkg/tlperl/lib/autodie.pm @@ -9,7 +9,7 @@ our $VERSION; # ABSTRACT: Replace functions with ones that succeed or die with lexical scope BEGIN { - our $VERSION = '2.29'; # VERSION: Generated by DZP::OurPkg::Version + our $VERSION = '2.32'; # VERSION: Generated by DZP::OurPkg::Version } use constant ERROR_WRONG_FATAL => q{ @@ -116,32 +116,6 @@ Exceptions produced by the C<autodie> pragma are members of the L<autodie::exception> class. The preferred way to work with these exceptions under Perl 5.10 is as follows: - use feature qw(switch); - - eval { - use autodie; - - open(my $fh, '<', $some_file); - - my @records = <$fh>; - - # Do things with @records... - - close($fh); - - }; - - given ($@) { - when (undef) { say "No error"; } - when ('open') { say "Error from open"; } - when (':io') { say "Non-open, IO error."; } - when (':all') { say "All other autodie errors." } - default { say "Not an autodie error at all." } - } - -Under Perl 5.8, the C<given/when> structure is not available, so the -following structure may be used: - eval { use autodie; @@ -268,7 +242,7 @@ C<system> and C<exec> with: =head2 print -The autodie pragma B<<does not check calls to C<print>>>. +The autodie pragma B<does not check calls to C<print>Z<>>. =head2 flock @@ -370,6 +344,14 @@ any hints available. See also L<Fatal/DIAGNOSTICS>. +=head1 Tips and Tricks + +=head2 Importing autodie into another namespace than "caller" + +It is possible to import autodie into a different namespace by using +L<Import::Into>. However, you have to pass a "caller depth" (rather +than a package name) for this to work correctly. + =head1 BUGS "Used only once" warnings can be generated when C<autodie> or C<Fatal> |