#!/usr/bin/perl -- use strict; use warnings; use autodie 2.01; use autodie 'log'; # default logger use autodie log => sub { # custom logger no warnings 'uninitialized'; use POSIX(); use Carp(); use Scalar::Quote(); my ( $func, @args ) = @_; (@_) = ( POSIX::strftime( '%Y-%m-%d %H:%M:%S ', localtime ), "$func( ", join( ', ', map { Scalar::Quote::quote($_) } @args ), " )" ); goto &Carp::carp; }; open my($in), '<', __FILE__; close $in; system $^X, qw[ -le print(66) ]; systemx $^X, qw[ -le die(66) ]; __END__ 2009-07-02 01:45:45 main::open( undef, '<', 'test.pl' ) at test.pl line 23 2009-07-02 01:45:45 main::close( 'GLOB(0x182f970)' ) at test.pl line 24 2009-07-02 01:45:45 main::system( "C:\\Perl\\bin\\perl.exe", '-le', 'print(66)' ) at test.pl line 25 2009-07-02 01:45:45 main::system( "C:\\Perl\\bin\\perl.exe", '-le', 'die(66)' ) at test.pl line 26 66 at -e line 1. "C:\Perl\bin\perl.exe" unexpectedly returned exit value 255 at test.pl line 26 #### C:\perl\.cpanplus\5.8.9\build\autodie-2.03>perl -Mblib t\hints.t # Sub::Identify is loaded ok 1 - Id: copy ok 2 - Id: cp ok 3 - Id: move ok 4 - Id: mv ok 5 - Copying in scalar context should throw an error. ok 6 - The object isa autodie::exception ok 7 - Function should be original name not ok 8 - File::Copy returns zero on failure # Failed test 'File::Copy returns zero on failure' # at t\hints.t line 64. # got: '' # expected: '0' ok 9 - File::Copy called in scalar context ok 10 - Copying in list context should throw an error. ok 11 - The object isa autodie::exception ok 12 - Function should be original name not ok 13 - File::Copy returns zero on failure # Failed test 'File::Copy returns zero on failure' # at t\hints.t line 79. # Structures begin differing at: # $got->[0] = '' # $expected->[0] = '0' ok 14 - File::Copy called in list context ok 15 - fail_on_undef(1) ok 16 - fail_on_empty(undef) ok 17 - fail_on_empty() ok 18 - fail_on_false(1) ok 19 - fail_on_false(0) ok 20 - fail_on_empty(0) ok 21 - fail_on_undef(undef) ok 22 - fail_on_undef(0) ok 23 - fail_on_undef() ok 24 - fail_on_empty(1) ok 25 - fail_on_false(undef) ok 26 - fail_on_false() 1..26 # Looks like you failed 2 tests of 26.