Skip to content

Commit e4cce63

Browse files
committed
Update autodie to CPAN version 2.31
[DELTA] 2.31 2020-01-08 00:37:45-06:00 America/Chicago * TEST BUGFIX: Correct diag explain in t/version.t so it'll pass on perl 5.8 * TEST BUGFIX: Only test t/no-all.t if optional IPC::System::Simple is available * BUILD: Switch automated testing to github actions * TEST BUGFIX: Turn off t/kill.t for windows. Recent versions of windows seem to choke when doing: `kill 0, $$;` 2.30 2020-01-02 16:51:16-06:00 America/Chicago * BUGFIX: Fix a boolean logic precedence error causing a "useless use of numeric" warning when using kill with a signal of 0. Thanks to Maurice Aubrey for reporting the issue and providing a Pull Request for it. (GH#76) * BUGFIX: Apply patch from Niko Tyni to fix a scoping issue "no autodie" and the "system" sub. (GH#69) * BUGFIX / DOC: Update code and documentation about smartmatch to match current the current support in perl. Thanks to Zefram; cherry-picked from perl core. (GH#83) * DOC: Fix a POD error and some unnecessary spaces that tripped POD parsers. Thanks to Aaron Crane and Chase Whitener for reporting the issues plus providing Pull Requests for it. (GH#51 and GH#79) * DOC: Document how to use Import::Into with autodie. (GH#50) * BUILD: Clean up of dzil.ini removing some unnecessary test recommends. Thanks to Karen Etheridge for reporting the issue and providing a Pull Requests for it. (GH#78) * TEST BUGFIX: Set binmode on some file handles to fix issues on Windows. Thanks to Tony Cook; cherry-picked from perl core. (GH#83) * TEST / INTERNAL / TRAVIS: Also test with Perl 5.22, 5.24, 5.26 and 5.28.
1 parent fb58896 commit e4cce63

File tree

16 files changed

+129
-62
lines changed

16 files changed

+129
-62
lines changed

MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ cpan/autodie/t/lib/pujHa/ghach.pm autodie - Like a Klingon
116116
cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm autodie - With Klingon honour
117117
cpan/autodie/t/lib/Some/Module.pm autodie - blog_hints.t helper
118118
cpan/autodie/t/mkdir.t autodie - filesystem tests
119+
cpan/autodie/t/no-all.t
120+
cpan/autodie/t/no-default.t
119121
cpan/autodie/t/no_carp.t
120122
cpan/autodie/t/open.t autodie - Testing open
121123
cpan/autodie/t/read.t

Porting/Maintainers.pl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ package Maintainers;
137137
},
138138

139139
'autodie' => {
140-
'DISTRIBUTION' => 'PJF/autodie-2.29.tar.gz',
140+
'DISTRIBUTION' => 'TODDR/autodie-2.31.tar.gz',
141141
'FILES' => q[cpan/autodie],
142142
'EXCLUDED' => [
143143
qr{benchmarks},
144144
qr{README\.md},
145+
qr{^xt/},
145146
# All these tests depend upon external
146147
# modules that don't exist when we're
147148
# building the core. Hence, they can
@@ -159,17 +160,6 @@ package Maintainers;
159160
t/system.t
160161
)
161162
],
162-
'CUSTOMIZED' => [
163-
# CPAN RT 105344
164-
't/mkdir.t',
165-
# smartmatch changes
166-
'lib/autodie/exception.pm',
167-
'lib/autodie/hints.pm',
168-
't/exceptions.t',
169-
't/lib/Hints_pod_examples.pm',
170-
# CPAN RT#127762
171-
't/recv.t',
172-
],
173163
},
174164

175165
'AutoLoader' => {

cpan/autodie/lib/Fatal.pm

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use strict;
88
use warnings;
99
use Tie::RefHash; # To cache subroutine refs
1010
use Config;
11-
use Scalar::Util qw(set_prototype);
11+
use Scalar::Util qw(set_prototype looks_like_number);
1212

1313
use autodie::Util qw(
1414
fill_protos
@@ -55,7 +55,7 @@ use constant ERROR_58_HINTS => q{Non-subroutine %s hints for %s are not supporte
5555

5656
use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;
5757

58-
our $VERSION = '2.29'; # VERSION: Generated by DZP::OurPkg::Version
58+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg::Version
5959

6060
our $Debug ||= 0;
6161

@@ -165,6 +165,8 @@ my %TAGS = (
165165
':2.27' => [qw(:default)],
166166
':2.28' => [qw(:default)],
167167
':2.29' => [qw(:default)],
168+
':2.30' => [qw(:default)],
169+
':2.31' => [qw(:default)],
168170
);
169171

170172

@@ -580,7 +582,12 @@ sub unimport {
580582
# Record the current sub to be reinstalled at end of scope
581583
# and then restore the original (can be undef for "CORE::"
582584
# subs)
583-
$reinstall_subs{$symbol} = \&$sub;
585+
586+
{
587+
no strict 'refs'; ## no critic # to avoid: Can't use string (...) as a symbol ref ...
588+
$reinstall_subs{$symbol} = \&$sub
589+
if exists ${"${pkg}::"}{$symbol};
590+
}
584591
$uninstall_subs{$symbol} = $Original_user_sub{$sub};
585592

586593
}
@@ -1023,6 +1030,26 @@ sub _one_invocation {
10231030
};
10241031
}
10251032

1033+
if ($call eq 'CORE::kill') {
1034+
1035+
return qq[
1036+
1037+
my \$num_things = \@_ - $Returns_num_things_changed{$call};
1038+
my \$context = ! defined wantarray() ? 'void' : 'scalar';
1039+
my \$signal = \$_[0];
1040+
my \$retval = $call(@argv);
1041+
my \$sigzero = looks_like_number( \$signal ) && \$signal == 0;
1042+
1043+
if ( ( \$sigzero && \$context eq 'void' )
1044+
or ( ! \$sigzero && \$retval != \$num_things ) ) {
1045+
1046+
$die;
1047+
}
1048+
1049+
return \$retval;
1050+
];
1051+
}
1052+
10261053
if (exists $Returns_num_things_changed{$call}) {
10271054

10281055
# Some things return the number of things changed (like

cpan/autodie/lib/autodie.pm

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ our $VERSION;
99
# ABSTRACT: Replace functions with ones that succeed or die with lexical scope
1010

1111
BEGIN {
12-
our $VERSION = '2.29'; # VERSION: Generated by DZP::OurPkg::Version
12+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg::Version
1313
}
1414

1515
use constant ERROR_WRONG_FATAL => q{
@@ -116,32 +116,6 @@ Exceptions produced by the C<autodie> pragma are members of the
116116
L<autodie::exception> class. The preferred way to work with
117117
these exceptions under Perl 5.10 is as follows:
118118
119-
use feature qw(switch);
120-
121-
eval {
122-
use autodie;
123-
124-
open(my $fh, '<', $some_file);
125-
126-
my @records = <$fh>;
127-
128-
# Do things with @records...
129-
130-
close($fh);
131-
132-
};
133-
134-
given ($@) {
135-
when (undef) { say "No error"; }
136-
when ('open') { say "Error from open"; }
137-
when (':io') { say "Non-open, IO error."; }
138-
when (':all') { say "All other autodie errors." }
139-
default { say "Not an autodie error at all." }
140-
}
141-
142-
Under Perl 5.8, the C<given/when> structure is not available, so the
143-
following structure may be used:
144-
145119
eval {
146120
use autodie;
147121
@@ -268,7 +242,7 @@ C<system> and C<exec> with:
268242
269243
=head2 print
270244
271-
The autodie pragma B<<does not check calls to C<print>>>.
245+
The autodie pragma B<does not check calls to C<print>Z<>>.
272246
273247
=head2 flock
274248
@@ -370,6 +344,14 @@ any hints available.
370344
371345
See also L<Fatal/DIAGNOSTICS>.
372346
347+
=head1 Tips and Tricks
348+
349+
=head2 Importing autodie into another namespace than "caller"
350+
351+
It is possible to import autodie into a different namespace by using
352+
L<Import::Into>. However, you have to pass a "caller depth" (rather
353+
than a package name) for this to work correctly.
354+
373355
=head1 BUGS
374356
375357
"Used only once" warnings can be generated when C<autodie> or C<Fatal>

cpan/autodie/lib/autodie/Scope/Guard.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55

66
# ABSTRACT: Wrapper class for calling subs at end of scope
7-
our $VERSION = '2.29'; # VERSION
7+
our $VERSION = '2.31'; # VERSION
88

99
# This code schedules the cleanup of subroutines at the end of
1010
# scope. It's directly inspired by chocolateboy's excellent

cpan/autodie/lib/autodie/Scope/GuardStack.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use warnings;
66
use autodie::Scope::Guard;
77

88
# ABSTRACT: Hook stack for managing scopes via %^H
9-
our $VERSION = '2.29'; # VERSION
9+
our $VERSION = '2.31'; # VERSION
1010

1111
my $H_KEY_STEM = __PACKAGE__ . '/guard';
1212
my $COUNTER = 0;

cpan/autodie/lib/autodie/Util.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ our @EXPORT_OK = qw(
1414
on_end_of_compile_scope
1515
);
1616

17-
our $VERSION = '2.29'; # VERSION: Generated by DZP::OurPkg:Version
17+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg:Version
1818

1919
# ABSTRACT: Internal Utility subroutines for autodie and Fatal
2020

cpan/autodie/lib/autodie/exception.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55
use Carp qw(croak);
66

7-
our $VERSION = '2.29002';
7+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg:Version
88
# ABSTRACT: Exceptions from autodying functions.
99

1010
our $DEBUG = 0;

cpan/autodie/lib/autodie/exception/system.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use warnings;
55
use parent 'autodie::exception';
66
use Carp qw(croak);
77

8-
our $VERSION = '2.29'; # VERSION: Generated by DZP::OurPkg:Version
8+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg:Version
99

1010
# ABSTRACT: Exceptions from autodying system().
1111

cpan/autodie/lib/autodie/hints.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use warnings;
55

66
use constant PERL58 => ( $] < 5.009 );
77

8-
our $VERSION = '2.29001';
8+
our $VERSION = '2.31'; # VERSION: Generated by DZP::OurPkg:Version
99

1010
# ABSTRACT: Provide hints about user subroutines to autodie
1111

@@ -121,7 +121,7 @@ other things. You can specify different hints for how
121121
failure should be identified in scalar and list contexts.
122122
123123
These examples apply for use in the C<AUTODIE_HINTS> subroutine and when
124-
calling C<autodie::hints->set_hints_for()>.
124+
calling C<< autodie::hints->set_hints_for() >>.
125125
126126
The most common context-specific hints are:
127127

0 commit comments

Comments
 (0)