diff -Nru libsafe-isa-perl-1.000008/Changes libsafe-isa-perl-1.000010/Changes --- libsafe-isa-perl-1.000008/Changes 2017-10-03 01:12:06.000000000 +0000 +++ libsafe-isa-perl-1.000010/Changes 2018-04-25 23:12:43.000000000 +0000 @@ -1,5 +1,12 @@ Revision history for Safe-Isa +1.000010 - 2018-04-25 + - fix DOES tests on 5.8.x + +1.000009 - 2018-04-21 + - Fix handling of DOES and does (they no longer fall back to isa in most + situations outside of Moo/Moose) + 1.000008 - 2017-10-03 - fix scalar/list context handling for $_call_if_can diff -Nru libsafe-isa-perl-1.000008/debian/changelog libsafe-isa-perl-1.000010/debian/changelog --- libsafe-isa-perl-1.000008/debian/changelog 2017-11-15 19:25:10.000000000 +0000 +++ libsafe-isa-perl-1.000010/debian/changelog 2018-05-06 17:18:30.000000000 +0000 @@ -1,3 +1,22 @@ +libsafe-isa-perl (1.000010-1) unstable; urgency=medium + + * Team upload. + + [ Damyan Ivanov ] + * declare conformance with Policy 4.1.3 (no changes needed) + + [ Salvatore Bonaccorso ] + * Update Vcs-* headers for switch to salsa.debian.org + + [ gregor herrmann ] + * Import upstream version 1.000010. + * Update debian/upstream/metadata. + * Update upstream contact in debian/copyright. + * Declare compliance with Debian Policy 4.1.4. + * Bump debhelper compatibility level to 10. + + -- gregor herrmann Sun, 06 May 2018 19:18:30 +0200 + libsafe-isa-perl (1.000008-1) unstable; urgency=medium * Team upload. diff -Nru libsafe-isa-perl-1.000008/debian/compat libsafe-isa-perl-1.000010/debian/compat --- libsafe-isa-perl-1.000008/debian/compat 2017-11-15 19:25:10.000000000 +0000 +++ libsafe-isa-perl-1.000010/debian/compat 2018-05-06 17:18:30.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru libsafe-isa-perl-1.000008/debian/control libsafe-isa-perl-1.000010/debian/control --- libsafe-isa-perl-1.000008/debian/control 2017-11-15 19:25:10.000000000 +0000 +++ libsafe-isa-perl-1.000010/debian/control 2018-05-06 17:18:30.000000000 +0000 @@ -2,14 +2,14 @@ Maintainer: Debian Perl Group Uploaders: Nuno Carvalho Section: perl +Testsuite: autopkgtest-pkg-perl Priority: optional -Build-Depends: debhelper (>= 9) +Build-Depends: debhelper (>= 10) Build-Depends-Indep: perl -Standards-Version: 4.1.1 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libsafe-isa-perl.git -Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libsafe-isa-perl.git +Standards-Version: 4.1.4 +Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libsafe-isa-perl +Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libsafe-isa-perl.git Homepage: https://metacpan.org/release/Safe-Isa -Testsuite: autopkgtest-pkg-perl Package: libsafe-isa-perl Architecture: all diff -Nru libsafe-isa-perl-1.000008/debian/copyright libsafe-isa-perl-1.000010/debian/copyright --- libsafe-isa-perl-1.000008/debian/copyright 2017-11-15 19:25:10.000000000 +0000 +++ libsafe-isa-perl-1.000010/debian/copyright 2018-05-06 17:18:30.000000000 +0000 @@ -1,19 +1,16 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Safe-Isa -Upstream-Contact: Matt S. Trout +Upstream-Contact: Karen Etheridge Source: https://metacpan.org/release/Safe-Isa - Files: * Copyright: 2012, Matt S. Trout License: Artistic or GPL-1+ - Files: debian/* Copyright: 2012, Nuno Carvalho License: Artistic or GPL-1+ - License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. diff -Nru libsafe-isa-perl-1.000008/debian/upstream/metadata libsafe-isa-perl-1.000010/debian/upstream/metadata --- libsafe-isa-perl-1.000008/debian/upstream/metadata 2017-11-15 19:25:10.000000000 +0000 +++ libsafe-isa-perl-1.000010/debian/upstream/metadata 2018-05-06 17:18:30.000000000 +0000 @@ -2,7 +2,7 @@ Archive: CPAN Bug-Database: https://rt.cpan.org/Public/Dist/Display.html?Name=Safe-Isa Bug-Submit: bug-Safe-Isa@rt.cpan.org -Contact: mst - Matt S. Trout (cpan:MSTROUT) +Contact: Karen Etheridge Name: Safe-Isa -Repository: git://git.shadowcat.co.uk/p5sagit/Safe-Isa.git -Repository-Browse: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Safe-Isa.git +Repository: https://github.com/p5sagit/Safe-Isa.git +Repository-Browse: https://github.com/p5sagit/Safe-Isa diff -Nru libsafe-isa-perl-1.000008/lib/Safe/Isa.pm libsafe-isa-perl-1.000010/lib/Safe/Isa.pm --- libsafe-isa-perl-1.000008/lib/Safe/Isa.pm 2017-10-03 01:11:43.000000000 +0000 +++ libsafe-isa-perl-1.000010/lib/Safe/Isa.pm 2018-04-21 17:14:06.000000000 +0000 @@ -5,7 +5,7 @@ use Scalar::Util (); use Exporter 5.57 qw(import); -our $VERSION = '1.000008'; +our $VERSION = '1.000010'; our @EXPORT = qw($_call_if_object $_isa $_can $_does $_DOES $_call_if_can); @@ -15,14 +15,13 @@ # we gratuitously break modules like Scalar::Defer, which would be # un-perlish. return unless Scalar::Util::blessed($obj); - return $obj->isa(@_) if lc($method) eq 'does' and not $obj->can($method); return $obj->$method(@_); }; -our ($_isa, $_can, $_does, $_DOES) = map { +our ($_isa, $_can) = map { my $method = $_; sub { my $obj = shift; $obj->$_call_if_object($method => @_) } -} qw(isa can does DOES); +} qw(isa can); our $_call_if_can = sub { my ($obj, $method) = (shift, shift); @@ -30,6 +29,19 @@ return $obj->$method(@_); }; +our $_does = sub { + my $obj = shift; + $obj->$_call_if_can(does => @_); +}; + +our $_DOES = sub { + my $obj = shift; + return unless Scalar::Util::blessed($obj); + return $obj->DOES(@_) + if $obj->can('DOES'); + return $obj->isa(@_); +}; + 1; __END__ @@ -148,14 +160,17 @@ $maybe_an_object->$_does('Foo'); If called on an object, calls C on it and returns the result, otherwise -returns nothing. +returns nothing. If the C method does not exist, returns nothing rather +than failing. =head2 $_DOES $maybe_an_object->$_DOES('Foo'); If called on an object, calls C on it and returns the result, otherwise -returns nothing. +returns nothing. On perl versions prior to 5.10.0, the built in core C +method doesn't exist. If the method doesn't exist, this will fall back to +calling C just like the core C method. =head2 $_call_if_object diff -Nru libsafe-isa-perl-1.000008/Makefile.PL libsafe-isa-perl-1.000010/Makefile.PL --- libsafe-isa-perl-1.000008/Makefile.PL 2017-09-21 23:48:05.000000000 +0000 +++ libsafe-isa-perl-1.000010/Makefile.PL 2018-04-25 22:58:19.000000000 +0000 @@ -1,6 +1,5 @@ use strict; use warnings FATAL => 'all'; -use 5.008001; use ExtUtils::MakeMaker; (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; @@ -11,12 +10,15 @@ META_MERGE => { 'meta-spec' => { version => 2 }, dynamic_config => 0, - resources => { + # GitHub mirrors from Shadowcat. We list it so we can get pull requests. + # The canonical repo is: + # r/o: git://git.shadowcat.co.uk/p5sagit/Safe-Isa.git # r/w: p5sagit@git.shadowcat.co.uk:Safe-Isa.git + # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Safe-Isa.git repository => { - url => 'git://git.shadowcat.co.uk/p5sagit/Safe-Isa.git', - web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Safe-Isa.git', + url => 'https://github.com/p5sagit/Safe-Isa.git', + web => 'https://github.com/p5sagit/Safe-Isa', type => 'git', }, bugtracker => { @@ -24,6 +26,12 @@ web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Safe-Isa', }, }, + x_contributors => [ # manually added, from git shortlog -e -s -n + 'Karen Etheridge ', + 'Matt S Trout ', + 'Graham Knop ', + 'David Steinbrunner ', + ], }, META_ADD => { diff -Nru libsafe-isa-perl-1.000008/META.json libsafe-isa-perl-1.000010/META.json --- libsafe-isa-perl-1.000008/META.json 2017-10-03 01:12:18.000000000 +0000 +++ libsafe-isa-perl-1.000010/META.json 2018-04-25 23:12:52.000000000 +0000 @@ -4,7 +4,7 @@ "mst - Matt S. Trout (cpan:MSTROUT) " ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.3103, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -46,10 +46,16 @@ }, "repository" : { "type" : "git", - "url" : "git://git.shadowcat.co.uk/p5sagit/Safe-Isa.git", - "web" : "http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Safe-Isa.git" + "url" : "https://github.com/p5sagit/Safe-Isa.git", + "web" : "https://github.com/p5sagit/Safe-Isa" } }, - "version" : "1.000008", - "x_serialization_backend" : "JSON::MaybeXS version 1.003009" + "version" : "1.000010", + "x_contributors" : [ + "Karen Etheridge ", + "Matt S Trout ", + "Graham Knop ", + "David Steinbrunner " + ], + "x_serialization_backend" : "JSON::MaybeXS version 1.004" } diff -Nru libsafe-isa-perl-1.000008/META.yml libsafe-isa-perl-1.000010/META.yml --- libsafe-isa-perl-1.000008/META.yml 2017-10-03 01:12:18.000000000 +0000 +++ libsafe-isa-perl-1.000010/META.yml 2018-04-25 23:12:52.000000000 +0000 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.3103, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -23,6 +23,11 @@ perl: '5.006' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Safe-Isa - repository: git://git.shadowcat.co.uk/p5sagit/Safe-Isa.git -version: '1.000008' + repository: https://github.com/p5sagit/Safe-Isa.git +version: '1.000010' +x_contributors: + - 'Karen Etheridge ' + - 'Matt S Trout ' + - 'Graham Knop ' + - 'David Steinbrunner ' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libsafe-isa-perl-1.000008/README libsafe-isa-perl-1.000010/README --- libsafe-isa-perl-1.000008/README 2017-10-03 01:12:18.000000000 +0000 +++ libsafe-isa-perl-1.000010/README 2018-04-25 23:12:53.000000000 +0000 @@ -106,13 +106,16 @@ $maybe_an_object->$_does('Foo'); If called on an object, calls "does" on it and returns the result, - otherwise returns nothing. + otherwise returns nothing. If the "does" method does not exist, returns + nothing rather than failing. $_DOES $maybe_an_object->$_DOES('Foo'); If called on an object, calls "DOES" on it and returns the result, - otherwise returns nothing. + otherwise returns nothing. On perl versions prior to 5.10.0, the built + in core "DOES" method doesn't exist. If the method doesn't exist, this + will fall back to calling "isa" just like the core "DOES" method. $_call_if_object $maybe_an_object->$_call_if_object(method_name => @args); diff -Nru libsafe-isa-perl-1.000008/t/safe_does.t libsafe-isa-perl-1.000010/t/safe_does.t --- libsafe-isa-perl-1.000008/t/safe_does.t 2015-03-15 01:12:50.000000000 +0000 +++ libsafe-isa-perl-1.000010/t/safe_does.t 2018-04-25 22:42:45.000000000 +0000 @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 20; { package Foo; sub new { bless({}, $_[0]) } } { package Bar; our @ISA = qw(Foo); sub bar { 1 } sub does { $_[0]->isa($_[1]) } } @@ -36,9 +36,25 @@ ok(eval { $blam->$_DOES('Foo'); 1 }, 'no boom today'); ok(eval { $undef->$_DOES('Foo'); 1 }, 'nor tomorrow either'); +# does should not fall back to isa +ok(!$foo->$_does('Foo'), 'foo !$_does Foo'); +ok($bar->$_does('Foo'), 'bar $_does Foo'); +ok(eval { $blam->$_does('Foo'); 1 }, 'no boom today'); +ok(eval { $undef->$_does('Foo'); 1 }, 'nor tomorrow either'); + +if (UNIVERSAL->can('DOES')) { + ok($foo->$_call_if_object(DOES => 'Foo'), 'foo $_call_if_object(DOES => Foo)'); + ok($bar->$_call_if_object(DOES => 'Foo'), 'bar $_call_if_object(DOES => Foo)'); +} +else { + ok(!eval { $foo->$_call_if_object(DOES => 'Foo'); 1 }, + 'foo $_call_if_object(DOES => Foo) fails without UNIVERSAL::DOES'); + ok(!eval { $bar->$_call_if_object(DOES => 'Foo'); 1 }, + 'bar $_call_if_object(DOES => Foo) fails without UNIVERSAL::DOES'); +} -ok($foo->$_call_if_object(DOES => 'Foo'), 'foo $_call_if_object(DOES => Foo)'); -ok($bar->$_call_if_object(DOES => 'Foo'), 'bar $_call_if_object(DOES => Foo)'); ok(eval { $blam->$_call_if_object(DOES => 'Foo'); 1 }, 'no boom today'); ok(eval { $undef->$_call_if_object(DOES => 'Foo'); 1 }, 'nor tomorrow either'); +ok(!eval { $foo->$_call_if_object(does => 'Foo'); 1 }, 'no special DOES handling built into _call_if_object'); +ok(!eval { $foo->$_call_if_object(Does => 'Foo'); 1 }, 'and no handling for wrong case');