Hello community,

here is the log from the commit of package perl-Safe-Isa for openSUSE:Factory 
checked in at 2017-10-09 19:45:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Safe-Isa (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Safe-Isa.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Safe-Isa"

Mon Oct  9 19:45:56 2017 rev:6 rq:532532 version:1.000008

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Safe-Isa/perl-Safe-Isa.changes      
2017-10-03 23:17:42.730811647 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Safe-Isa.new/perl-Safe-Isa.changes 
2017-10-09 19:48:11.387666603 +0200
@@ -1,0 +2,9 @@
+Sun Oct  8 08:07:04 UTC 2017 - co...@suse.com
+
+- updated to 1.000008
+   see /usr/share/doc/packages/perl-Safe-Isa/Changes
+
+  1.000008 - 2017-10-03
+    - fix scalar/list context handling for $_call_if_can
+
+-------------------------------------------------------------------

Old:
----
  Safe-Isa-1.000007.tar.gz

New:
----
  Safe-Isa-1.000008.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Safe-Isa.spec ++++++
--- /var/tmp/diff_new_pack.9YkFXy/_old  2017-10-09 19:48:12.583614041 +0200
+++ /var/tmp/diff_new_pack.9YkFXy/_new  2017-10-09 19:48:12.607612986 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Safe-Isa
-Version:        1.000007
+Version:        1.000008
 Release:        0
 %define cpan_name Safe-Isa
 Summary:        Call isa, can, does and DOES safely on things that may not be 
objects
@@ -66,6 +66,9 @@
 'is_module_name' function from Module::Runtime is a good way to check for
 something you might be able to call methods on if you want to do that.
 
+We are careful to make sure that scalar/list context is preserved for the
+method that is eventually called.
+
 %prep
 %setup -q -n %{cpan_name}-%{version}
 

++++++ Safe-Isa-1.000007.tar.gz -> Safe-Isa-1.000008.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/Changes 
new/Safe-Isa-1.000008/Changes
--- old/Safe-Isa-1.000007/Changes       2017-09-22 04:23:38.000000000 +0200
+++ new/Safe-Isa-1.000008/Changes       2017-10-03 03:12:06.000000000 +0200
@@ -1,5 +1,8 @@
 Revision history for Safe-Isa
 
+1.000008 - 2017-10-03
+  - fix scalar/list context handling for $_call_if_can
+
 1.000007 - 2017-09-22
   - added new interface: $obj->$_call_if_can
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/META.json 
new/Safe-Isa-1.000008/META.json
--- old/Safe-Isa-1.000007/META.json     2017-09-22 04:24:11.000000000 +0200
+++ new/Safe-Isa-1.000008/META.json     2017-10-03 03:12:18.000000000 +0200
@@ -50,6 +50,6 @@
          "web" : 
"http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Safe-Isa.git";
       }
    },
-   "version" : "1.000007",
+   "version" : "1.000008",
    "x_serialization_backend" : "JSON::MaybeXS version 1.003009"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/META.yml 
new/Safe-Isa-1.000008/META.yml
--- old/Safe-Isa-1.000007/META.yml      2017-09-22 04:24:11.000000000 +0200
+++ new/Safe-Isa-1.000008/META.yml      2017-10-03 03:12:18.000000000 +0200
@@ -24,5 +24,5 @@
 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.000007'
+version: '1.000008'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/README new/Safe-Isa-1.000008/README
--- old/Safe-Isa-1.000007/README        2017-09-22 04:24:11.000000000 +0200
+++ new/Safe-Isa-1.000008/README        2017-10-03 03:12:18.000000000 +0200
@@ -86,6 +86,9 @@
     way to check for something you might be able to call methods on if you
     want to do that.
 
+    We are careful to make sure that scalar/list context is preserved for
+    the method that is eventually called.
+
 EXPORTS
   $_isa
       $maybe_an_object->$_isa('Foo');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/lib/Safe/Isa.pm 
new/Safe-Isa-1.000008/lib/Safe/Isa.pm
--- old/Safe-Isa-1.000007/lib/Safe/Isa.pm       2017-09-22 04:21:32.000000000 
+0200
+++ new/Safe-Isa-1.000008/lib/Safe/Isa.pm       2017-10-03 03:11:43.000000000 
+0200
@@ -5,7 +5,7 @@
 use Scalar::Util ();
 use Exporter 5.57 qw(import);
 
-our $VERSION = '1.000007';
+our $VERSION = '1.000008';
 
 our @EXPORT = qw($_call_if_object $_isa $_can $_does $_DOES $_call_if_can);
 
@@ -26,7 +26,8 @@
 
 our $_call_if_can = sub {
   my ($obj, $method) = (shift, shift);
-  $obj->$_call_if_object(can => $method) && $obj->$_call_if_object($method => 
@_);
+  return unless $obj->$_call_if_object(can => $method);
+  return $obj->$method(@_);
 };
 
 1;
@@ -123,6 +124,9 @@
 C<is_module_name> function from L<Module::Runtime> is a good way to check for
 something you might be able to call methods on if you want to do that.
 
+We are careful to make sure that scalar/list context is preserved for the
+method that is eventually called.
+
 =head1 EXPORTS
 
 =head2 $_isa
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Safe-Isa-1.000007/t/safe_isa.t 
new/Safe-Isa-1.000008/t/safe_isa.t
--- old/Safe-Isa-1.000007/t/safe_isa.t  2017-09-22 04:21:32.000000000 +0200
+++ new/Safe-Isa-1.000008/t/safe_isa.t  2017-10-03 02:51:37.000000000 +0200
@@ -1,9 +1,9 @@
 use strict;
 use warnings;
-use Test::More tests => 38;
+use Test::More tests => 68;
 
 { package Foo; sub new { bless({}, $_[0]) } }
-{ package Bar; our @ISA = qw(Foo); sub bar { $_[1] } }
+{ package Bar; our @ISA = qw(Foo); sub bar { wantarray ? ( 5, 6 ) : $_[1] } }
 
 my $foo = Foo->new;
 my $bar = Bar->new;
@@ -25,6 +25,8 @@
 
 use Safe::Isa;
 
+note 'scalar context..';
+
 ok($foo->$_isa('Foo'), 'foo $_isa Foo');
 ok($bar->$_isa('Foo'), 'bar $_isa Foo');
 ok(eval { is($blam->$_isa('Foo'), undef, 'blam isn\'t Foo'); 1 }, 'no boom 
today');
@@ -37,7 +39,7 @@
 
 ok($foo->$_call_if_object(isa => 'Foo'), 'foo $_call_if_object(isa => Foo)');
 ok($bar->$_call_if_object(isa => 'Foo'), 'bar $_call_if_object(isa => Foo)');
-is($bar->$_call_if_object(bar => ), undef, 'bar $_call_if_object(bar => 
undef)');
+is($bar->$_call_if_object(bar => ), undef, 'bar $_call_if_object(bar => )');
 is($bar->$_call_if_object(bar => 2), 2, 'bar $_call_if_object(bar => 2)');
 ok(eval { is($blam->$_call_if_object(isa => 'Foo'), undef, 'blam can\'t call 
anything'); 1 }, 'no boom today');
 ok(eval { is($undef->$_call_if_object(isa => 'Foo'), undef, 'undef can\'t call 
anything'); 1 }, 'and no boom tomorrow either');
@@ -45,7 +47,68 @@
 ok($foo->$_call_if_can(isa => 'Foo'), 'foo $_call_if_can(isa => Foo)');
 ok($bar->$_call_if_can(isa => 'Foo'), 'bar $_call_if_can(isa => Foo)');
 ok(eval { is($foo->$_call_if_can(bar => ), undef, 'foo can\'t call bar'); 1 }, 
'no boom today');
-is($bar->$_call_if_can(bar => ), undef, 'bar $_call_if_can(bar => ');
-is($bar->$_call_if_can(bar => 2), 2, 'bar $_call_if_can(bar => 2');
+is($bar->$_call_if_can(bar => ), undef, 'bar $_call_if_can(bar => )');
+is($bar->$_call_if_can(bar => 2), 2, 'bar $_call_if_can(bar => 2)');
 ok(eval { is($blam->$_call_if_can(isa => 'Foo'), undef, 'blam can\'t call 
anything'); 1 }, 'no boom today');
 ok(eval { is($undef->$_call_if_can(isa => 'Foo'), undef, 'undef can\'t call 
anything'); 1 }, 'and no boom tomorrow either');
+
+
+note 'list context..';
+
+# isa always returns true/false
+is_deeply([ $foo->$_isa('Foo') ], [ 1 ], 'foo $_isa Foo');
+is_deeply([ $bar->$_isa('Foo') ], [ 1 ], 'bar $_isa Foo');
+ok(
+    eval { is_deeply([ $blam->$_isa('Foo') ], [], 'blam isn\'t Foo'); 1 },
+    'no boom today',
+);
+ok(
+    eval { is_deeply([ $undef->$_isa('Foo') ], [], 'undef isn\'t Foo either'); 
1 },
+    'and no boom tomorrow either',
+);
+
+# can returns ref/undef if it ran, or false if not an object.
+is_deeply([ $foo->$_can('bar') ], [ undef ], 'foo !$_can bar');
+is_deeply([ $bar->$_can('bar') ], [ \&Bar::bar ], 'bar $_can bar');
+ok(
+    eval { is_deeply([ $blam->$_can('bar') ], [], 'blam can\'t bar'); 1 },
+    'no boom today',
+);
+ok(
+    eval { is_deeply([ $undef->$_can('bar') ], [], 'undef can\'t bar either'); 
1 },
+    'and no boom tomorrow either',
+);
+
+# _call_if_object has the same behaviour as the method it is calling and
+# propagates context.
+is_deeply([ $foo->$_call_if_object(isa => 'Foo') ], [ 1 ], 'foo 
$_call_if_object(isa => Foo)');
+is_deeply([ $bar->$_call_if_object(isa => 'Foo') ], [ 1 ], 'bar 
$_call_if_object(isa => Foo)');
+is_deeply([ $bar->$_call_if_object(bar => ) ], [ 5, 6 ], 'bar 
$_call_if_object(bar => undef): wantarray is true');
+is_deeply([ $bar->$_call_if_object(bar => 2) ], [ 5, 6 ], 'bar 
$_call_if_object(bar => 2): wantarray is true');
+ok(
+    eval { is_deeply([ $blam->$_call_if_object(isa => 'Foo') ], [], 'blam 
can\'t call anything'); 1 },
+    'no boom today',
+);
+ok(
+    eval { is_deeply([ $undef->$_call_if_object(isa => 'Foo') ], [], 'undef 
can\'t call anything'); 1 },
+    'and no boom tomorrow either',
+);
+
+# _call_if_can has the same behaviour as the method it is calling and
+# propagates context.
+is_deeply([ $foo->$_call_if_can(isa => 'Foo') ], [ 1 ], 'foo $_call_if_can(isa 
=> Foo)');
+is_deeply([ $bar->$_call_if_can(isa => 'Foo') ], [ 1 ], 'bar $_call_if_can(isa 
=> Foo)');
+ok(
+    eval { is_deeply([ $foo->$_call_if_can(bar => ) ], [], 'foo can\'t call 
bar'); 1 },
+    'no boom today',
+);
+is_deeply([ $bar->$_call_if_can(bar => ) ], [ 5, 6 ], 'bar $_call_if_can(bar 
=> ): wantarray is true');
+is_deeply([ $bar->$_call_if_can(bar => 2) ], [ 5, 6 ], 'bar $_call_if_can(bar 
=> 2): wantarray is true');
+ok(
+    eval { is_deeply([ $blam->$_call_if_can(isa => 'Foo') ], [], 'blam can\'t 
call anything'); 1 },
+    'no boom today',
+);
+ok(
+    eval { is_deeply([ $undef->$_call_if_can(isa => 'Foo') ], [], 'undef 
can\'t call anything'); 1 },
+    'and no boom tomorrow either',
+);


Reply via email to