Skip to content

Commit

Permalink
cpan/autodie - Update to version 2.37
Browse files Browse the repository at this point in the history
2.37      2023-12-28 19:12:52+00:00 UTC

	* #117 - Deprecate smartmatch handling

	* #118 - Remove mention of cpanratings.perl.org

	* #119 - Fix typo in changelog
  • Loading branch information
toddr authored and jkeenan committed Dec 30, 2023
1 parent 4627134 commit e2070c2
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 112 deletions.
47 changes: 23 additions & 24 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,32 @@ cpan/autodie/lib/autodie.pm Functions succeed or die with lexical scope
cpan/autodie/lib/autodie/exception.pm Exception class for autodie
cpan/autodie/lib/autodie/exception/system.pm Exception class for autodying system()
cpan/autodie/lib/autodie/hints.pm Hinting interface for autodie
cpan/autodie/lib/autodie/Scope/Guard.pm
cpan/autodie/lib/autodie/Scope/GuardStack.pm
cpan/autodie/lib/autodie/skip.pm
cpan/autodie/lib/autodie/Util.pm
cpan/autodie/lib/autodie/Scope/Guard.pm Module related to autodie
cpan/autodie/lib/autodie/Scope/GuardStack.pm Module related to autodie
cpan/autodie/lib/autodie/skip.pm Module related to autodie
cpan/autodie/lib/autodie/Util.pm Module related to autodie
cpan/autodie/lib/Fatal.pm Make errors in functions/builtins fatal
cpan/autodie/t/00-load.t autodie - basic load
cpan/autodie/t/args.t
cpan/autodie/t/args.t Test file related to autodie
cpan/autodie/t/autodie.t autodie - Basic functionality
cpan/autodie/t/autodie_skippy.pm
cpan/autodie/t/autodie_skippy.pm Module related to autodie
cpan/autodie/t/autodie_test_module.pm autodie - test helper
cpan/autodie/t/backcompat.t autodie - More Fatal backcompat
cpan/autodie/t/basic_exceptions.t autodie - Basic exception tests
cpan/autodie/t/binmode.t autodie - Binmode testing
cpan/autodie/t/blog_hints.t autodie - Tests fro PJF's blog
cpan/autodie/t/caller.t autodie - Caller diagnostics
cpan/autodie/t/chmod.t
cpan/autodie/t/chown.t
cpan/autodie/t/chmod.t Test file related to autodie
cpan/autodie/t/chown.t Test file related to autodie
cpan/autodie/t/context.t autodie - Context clobbering tests
cpan/autodie/t/context_lexical.t autodie - Context clobbering lexically
cpan/autodie/t/core-trampoline-slurp.t
cpan/autodie/t/core-trampoline-slurp.t Test file related to autodie
cpan/autodie/t/crickey.t autodie - Like an Australian
cpan/autodie/t/dbmopen.t autodie - dbm tests
cpan/autodie/t/eval_error.t
cpan/autodie/t/eval_error.t Test file related to autodie
cpan/autodie/t/exception_class.t autodie - Exception class subclasses
cpan/autodie/t/exception_nonref.t
cpan/autodie/t/exceptions.t autodie - 5.10 exception tests.
cpan/autodie/t/exception_nonref.t Test file related to autodie
cpan/autodie/t/exceptions-smartmatch.t autodie
cpan/autodie/t/exec.t autodie - exec tests.
cpan/autodie/t/Fatal.t autodie - Fatal backcompatibility
cpan/autodie/t/filehandles.t autodie - filehandle tests
Expand All @@ -287,10 +287,10 @@ cpan/autodie/t/hints_pod_examples.t autodie - Test hints POD examples
cpan/autodie/t/hints_provider_does.t autodie - Test hints/does roles
cpan/autodie/t/hints_provider_easy_does_it.t autodie - Test easy hints/does
cpan/autodie/t/hints_provider_isa.t autodie - Test hints/inheritance
cpan/autodie/t/import-into.t
cpan/autodie/t/import-into.t Test file related to autodie
cpan/autodie/t/internal.t autodie - internal interface tests
cpan/autodie/t/internal-backcompat.t autodie - Back-compatibility tests
cpan/autodie/t/kill.t
cpan/autodie/t/kill.t Test file related to autodie
cpan/autodie/t/lethal.t autodie - lethal is the one true name
cpan/autodie/t/lib/autodie/test/au.pm autodie - Australian helper
cpan/autodie/t/lib/autodie/test/au/exception.pm autodie - Australian helper
Expand All @@ -304,33 +304,32 @@ cpan/autodie/t/lib/Hints_provider_isa.pm autodie - Hints/inherit helper
cpan/autodie/t/lib/Hints_test.pm autodie - Hints test helper
cpan/autodie/t/lib/lethal.pm autodie - with a better name
cpan/autodie/t/lib/my/autodie.pm autodie - blog_hints.t helper
cpan/autodie/t/lib/my/pragma.pm
cpan/autodie/t/lib/my/pragma.pm Module related to autodie
cpan/autodie/t/lib/OtherTypes.pm autodie - Format clobberer helper.
cpan/autodie/t/lib/pujHa/ghach.pm autodie - Like a Klingon
cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm autodie - With Klingon honour
cpan/autodie/t/lib/Some/Module.pm autodie - blog_hints.t helper
cpan/autodie/t/mkdir.t autodie - filesystem tests
cpan/autodie/t/no-default.t
cpan/autodie/t/no_carp.t
cpan/autodie/t/no-default.t Test file related to autodie
cpan/autodie/t/no_carp.t Test file related to autodie
cpan/autodie/t/open.t autodie - Testing open
cpan/autodie/t/read.t
cpan/autodie/t/read.t Test file related to autodie
cpan/autodie/t/recv.t autodie - send/recv tests
cpan/autodie/t/repeat.t autodie - repeat autodie leak tests
cpan/autodie/t/rt-74246.t
cpan/autodie/t/rt-74246.t Test file related to autodie
cpan/autodie/t/scope_leak.t autodie - file scope leak tests
cpan/autodie/t/skip.t
cpan/autodie/t/skip.t Test file related to autodie
cpan/autodie/t/string-eval-basic.t autodie - Basic string eval test
cpan/autodie/t/string-eval-leak.t autodie - String eval leak test
cpan/autodie/t/sysopen.t autodie - sysopen tests
cpan/autodie/t/touch_me
cpan/autodie/t/truncate.t autodie - File truncation tests
cpan/autodie/t/unlink.t autodie - Unlink system tests.
cpan/autodie/t/user-context.t autodie - Context changes for usersubs
cpan/autodie/t/usersub.t autodie - user subroutine tests
cpan/autodie/t/utf8_open.t
cpan/autodie/t/utime.t
cpan/autodie/t/utf8_open.t Test file related to autodie
cpan/autodie/t/utime.t Test file related to autodie
cpan/autodie/t/version.t autodie - versioning tests
cpan/autodie/t/version_tag.t
cpan/autodie/t/version_tag.t Test file related to autodie
cpan/AutoLoader/lib/AutoLoader.pm Autoloader base class
cpan/AutoLoader/lib/AutoSplit.pm Split up autoload functions
cpan/AutoLoader/t/01AutoLoader.t See if AutoLoader works
Expand Down
3 changes: 2 additions & 1 deletion Porting/Maintainers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ package Maintainers;
},

'autodie' => {
'DISTRIBUTION' => 'TODDR/autodie-2.36.tar.gz',
'DISTRIBUTION' => 'TODDR/autodie-2.37.tar.gz',
'SYNCINFO' => 'jkeenan on Sat Dec 30 15:24:00 2023',
'FILES' => q[cpan/autodie],
'EXCLUDED' => [
qr{benchmarks},
Expand Down
96 changes: 61 additions & 35 deletions cpan/autodie/lib/Fatal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ use autodie::Util qw(
on_end_of_compile_scope
);

use constant PERL510 => ( $] >= 5.010 );
use constant SMARTMATCH_ALLOWED => ( $] >= 5.010 && $] < 5.041 );
use constant SMARTMATCH_CATEGORY => (
!SMARTMATCH_ALLOWED || $] < 5.018 ? undef
: exists $warnings::Offsets{'experimental::smartmatch'} ? 'experimental::smartmatch'
: 'deprecated'
);

use constant LEXICAL_TAG => q{:lexical};
use constant VOID_TAG => q{:void};
Expand Down Expand Up @@ -48,14 +53,16 @@ use constant ERROR_AUTODIE_CONFLICT => q{"no autodie '%s'" is not allowed while

use constant ERROR_FATAL_CONFLICT => q{"use Fatal '%s'" is not allowed while "no autodie '%s'" is in effect};

use constant ERROR_58_HINTS => q{Non-subroutine %s hints for %s are not supported under Perl 5.8.x};
use constant ERROR_SMARTMATCH_HINTS => q{%s hints for %s must be code, regexp, or undef. Use of other values is deprecated and only supported on Perl 5.10 through 5.40.};

use constant WARNING_SMARTMATCH_DEPRECATED => q{%s hints for %s must be code, regexp, or undef. Use of other values is deprecated and will be removed before Perl 5.42.};

# Older versions of IPC::System::Simple don't support all the
# features we need.

use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;

our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg::Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg::Version

our $Debug ||= 0;

Expand Down Expand Up @@ -172,6 +179,7 @@ my %TAGS = (
':2.34' => [qw(:default)],
':2.35' => [qw(:default)],
':2.36' => [qw(:default)],
':2.37' => [qw(:default)],
);


Expand Down Expand Up @@ -1089,8 +1097,6 @@ sub _one_invocation {

my $code = qq[
no warnings qw(unopened uninitialized numeric);
no if \$\] >= 5.017011, warnings => "experimental::smartmatch";
no if \$warnings::Offsets{"deprecated::smartmatch"}, warnings => "deprecated";
if (wantarray) {
my \@results = $call(@argv);
Expand All @@ -1101,25 +1107,37 @@ sub _one_invocation {

my $retval_action = $Retval_action{$call} || '';

if ( $hints and ( ref($hints->{list} ) || "" ) eq 'CODE' ) {
if ( $hints && exists $hints->{list} ) {
my $match;
if ( ref($hints->{list}) eq 'CODE' ) {
# NB: Subroutine hints are passed as a full list.
# This differs from the 5.10.0 smart-match behaviour,
# but means that context unaware subroutines can use
# the same hints in both list and scalar context.

# NB: Subroutine hints are passed as a full list.
# This differs from the 5.10.0 smart-match behaviour,
# but means that context unaware subroutines can use
# the same hints in both list and scalar context.
$match = q[ $hints->{list}->(@results) ];
}
elsif ( ref($hints->{list}) eq 'Regexp' ) {
$match = q[ grep $_ =~ $hints->{list}, @results ];
}
elsif ( !defined $hints->{list} ) {
$match = q[ grep !defined, @results ];
}
elsif ( SMARTMATCH_ALLOWED ) {
$match = q[ @results ~~ $hints->{list} ];
warnings::warnif('deprecated', sprintf(WARNING_SMARTMATCH_DEPRECATED, 'list', $sub));
if (SMARTMATCH_CATEGORY) {
$match = sprintf q[ do { no warnings '%s'; %s } ], SMARTMATCH_CATEGORY, $match;
}
}
else {
croak sprintf(ERROR_SMARTMATCH_HINTS, 'list', $sub);
}

$code .= qq{
if ( \$hints->{list}->(\@results) ) { $die };
};
}
elsif ( PERL510 and $hints ) {
$code .= qq{
if ( \@results ~~ \$hints->{list} ) { $die };
if ( $match ) { $die };
};
}
elsif ( $hints ) {
croak sprintf(ERROR_58_HINTS, 'list', $sub);
}
else {
$code .= qq{
# An empty list, or a single undef is failure
Expand All @@ -1146,29 +1164,37 @@ sub _one_invocation {
my \$context = "scalar";
};

if ( $hints and ( ref($hints->{scalar} ) || "" ) eq 'CODE' ) {

# We always call code refs directly, since that always
# works in 5.8.x, and always works in 5.10.1
if ( $hints && exists $hints->{scalar} ) {
my $match;

return $code .= qq{
if ( \$hints->{scalar}->(\$retval) ) { $die };
$retval_action
return \$retval;
};
if ( ref($hints->{scalar}) eq 'CODE' ) {
# We always call code refs directly, since that always
# works in 5.8.x, and always works in 5.10.1
$match = q[ $hints->{scalar}->($retval) ];
}
elsif ( ref($hints->{scalar}) eq 'Regexp' ) {
$match = q[ $retval =~ $hints->{scalar} ];
}
elsif ( !defined $hints->{scalar} ) {
$match = q[ !defined $retval ];
}
elsif (SMARTMATCH_ALLOWED) {
$match = q[ $retval ~~ $hints->{scalar} ];
warnings::warnif('deprecated', sprintf(WARNING_SMARTMATCH_DEPRECATED, 'scalar', $sub));
if (SMARTMATCH_CATEGORY) {
$match = sprintf q[ do { no warnings '%s'; %s } ], SMARTMATCH_CATEGORY, $match;
}
}
else {
croak sprintf(ERROR_SMARTMATCH_HINTS, 'scalar', $sub);
}

}
elsif (PERL510 and $hints) {
return $code . qq{
if ( \$retval ~~ \$hints->{scalar} ) { $die };
if ( $match ) { $die };
$retval_action
return \$retval;
};
}
elsif ( $hints ) {
croak sprintf(ERROR_58_HINTS, 'scalar', $sub);
}

return $code .
( $use_defined_or ? qq{
Expand Down
7 changes: 3 additions & 4 deletions cpan/autodie/lib/autodie.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ our $VERSION;
# ABSTRACT: Replace functions with ones that succeed or die with lexical scope

BEGIN {
our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg::Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg::Version
}

use constant ERROR_WRONG_FATAL => q{
Expand Down Expand Up @@ -396,9 +396,8 @@ L<https://github.com/pjf/autodie/issues>.
=head1 FEEDBACK
If you find this module useful, please consider rating it on the
CPAN Ratings service at
L<http://cpanratings.perl.org/rate?distribution=autodie> .
If you find this module useful, please consider rating it on metacpan at
L<https://metacpan.org/pod/autodie> .
The module author loves to hear how C<autodie> has made your life
better (or worse). Feedback can be sent to
Expand Down
2 changes: 1 addition & 1 deletion cpan/autodie/lib/autodie/Scope/Guard.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

# ABSTRACT: Wrapper class for calling subs at end of scope
our $VERSION = '2.36'; # VERSION
our $VERSION = '2.37'; # VERSION

# This code schedules the cleanup of subroutines at the end of
# scope. It's directly inspired by chocolateboy's excellent
Expand Down
2 changes: 1 addition & 1 deletion cpan/autodie/lib/autodie/Scope/GuardStack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use warnings;
use autodie::Scope::Guard;

# ABSTRACT: Hook stack for managing scopes via %^H
our $VERSION = '2.36'; # VERSION
our $VERSION = '2.37'; # VERSION

my $H_KEY_STEM = __PACKAGE__ . '/guard';
my $COUNTER = 0;
Expand Down
2 changes: 1 addition & 1 deletion cpan/autodie/lib/autodie/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ our @EXPORT_OK = qw(
on_end_of_compile_scope
);

our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg:Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg:Version

# ABSTRACT: Internal Utility subroutines for autodie and Fatal

Expand Down
6 changes: 3 additions & 3 deletions cpan/autodie/lib/autodie/exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ use Carp qw(croak);

use Scalar::Util qw(blessed);

our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg:Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg:Version
# ABSTRACT: Exceptions from autodying functions.

our $DEBUG = 0;

use overload
q{""} => "stringify",
# Overload smart-match only if we're using 5.10 or up
($] >= 5.010 ? ('~~' => "matches") : ()),
fallback => 1
(( $] >= 5.010 && $] < 5.041 ) ? ('~~' => "matches") : ()),
fallback => 1,
;

my $PACKAGE = __PACKAGE__; # Useful to have a scalar for hash keys.
Expand Down
2 changes: 1 addition & 1 deletion cpan/autodie/lib/autodie/exception/system.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;
use parent 'autodie::exception';
use Carp qw(croak);

our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg:Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg:Version

# ABSTRACT: Exceptions from autodying system().

Expand Down
11 changes: 6 additions & 5 deletions cpan/autodie/lib/autodie/hints.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;

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

our $VERSION = '2.36'; # VERSION: Generated by DZP::OurPkg:Version
our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg:Version

# ABSTRACT: Provide hints about user subroutines to autodie

Expand Down Expand Up @@ -101,10 +101,11 @@ return value of an autodying subroutine. If the match returns true,
C<autodie> considers the subroutine to have failed.
If the hint provided is a subroutine, then C<autodie> will pass
the complete return value to that subroutine. If the hint is
any other value, then C<autodie> will smart-match against the
value provided. In Perl 5.8.x there is no smart-match operator, and as such
only subroutine hints are supported in these versions.
the complete return value to that subroutine. If the hint is a regexp object,
then C<autodie> will match it against the return value. If the hint is undef,
the return value must be undef. On Perl versions 5.10 and newer, any other
value can be provided and it will be smart matched against the value provided.
However, smart matched values like this are deprecated.
Hints can be provided for both scalar and list contexts. Note
that an autodying subroutine will never see a void context, as
Expand Down
2 changes: 1 addition & 1 deletion cpan/autodie/lib/autodie/skip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package autodie::skip;
use strict;
use warnings;

our $VERSION = '2.36'; # VERSION
our $VERSION = '2.37'; # VERSION

# This package exists purely so people can inherit from it,
# which isn't at all how roles are supposed to work, but it's
Expand Down
Loading

0 comments on commit e2070c2

Please sign in to comment.