Hello community,
here is the log from the commit of package perl-Devel-OverloadInfo for
openSUSE:Factory checked in at 2015-08-27 08:56:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Devel-OverloadInfo (Old)
and /work/SRC/openSUSE:Factory/.perl-Devel-OverloadInfo.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Devel-OverloadInfo"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Devel-OverloadInfo/perl-Devel-OverloadInfo.changes
2015-05-06 11:19:09.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Devel-OverloadInfo.new/perl-Devel-OverloadInfo.changes
2015-08-27 08:56:33.000000000 +0200
@@ -1,0 +2,15 @@
+Sun Aug 23 08:42:46 UTC 2015 - [email protected]
+
+- updated to 0.004
+ see /usr/share/doc/packages/perl-Devel-OverloadInfo/Changes
+
+ 0.004 2015-08-13 17:35:32+01:00 Europe/London
+ - Document that existence of undef 'fallback' varies between perl versions
+ - Add tests for empty, inherited-only and no overloading
+ - Add is_overloaded() function
+
+ 0.003 2015-08-12 19:35:45+01:00 Europe/London
+ - Return an empty hash instead of undef for classes with no overloads
+ - Work around overload inheritance corruption before 5.16 (RT#106379)
+
+-------------------------------------------------------------------
Old:
----
Devel-OverloadInfo-0.002.tar.gz
New:
----
Devel-OverloadInfo-0.004.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Devel-OverloadInfo.spec ++++++
--- /var/tmp/diff_new_pack.iLZfU6/_old 2015-08-27 08:56:33.000000000 +0200
+++ /var/tmp/diff_new_pack.iLZfU6/_new 2015-08-27 08:56:33.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Devel-OverloadInfo
-Version: 0.002
+Version: 0.004
Release: 0
%define cpan_name Devel-OverloadInfo
Summary: Introspect Overloaded Operators
@@ -33,6 +33,7 @@
BuildRequires: perl(MRO::Compat)
BuildRequires: perl(Package::Stash) >= 0.14
BuildRequires: perl(Sub::Identify)
+BuildRequires: perl(Test::Fatal)
BuildRequires: perl(Test::More) >= 0.88
BuildRequires: perl(parent)
Requires: perl(MRO::Compat)
++++++ Devel-OverloadInfo-0.002.tar.gz -> Devel-OverloadInfo-0.004.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/Changes
new/Devel-OverloadInfo-0.004/Changes
--- old/Devel-OverloadInfo-0.002/Changes 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/Changes 2015-08-13 18:35:34.000000000
+0200
@@ -1,5 +1,14 @@
Revision history for Devel-OverloadInfo
+0.004 2015-08-13 17:35:32+01:00 Europe/London
+ - Document that existence of undef 'fallback' varies between perl versions
+ - Add tests for empty, inherited-only and no overloading
+ - Add is_overloaded() function
+
+0.003 2015-08-12 19:35:45+01:00 Europe/London
+ - Return an empty hash instead of undef for classes with no overloads
+ - Work around overload inheritance corruption before 5.16 (RT#106379)
+
0.002 2014-03-26 12:02:38+00:00 Europe/London
- Specify minimum required versions of Package::Stash and Exporter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/LICENSE
new/Devel-OverloadInfo-0.004/LICENSE
--- old/Devel-OverloadInfo-0.002/LICENSE 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/LICENSE 2015-08-13 18:35:34.000000000
+0200
@@ -22,7 +22,7 @@
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/MANIFEST
new/Devel-OverloadInfo-0.004/MANIFEST
--- old/Devel-OverloadInfo-0.002/MANIFEST 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/MANIFEST 2015-08-13 18:35:34.000000000
+0200
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v5.014.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v5.039.
Changes
LICENSE
MANIFEST
@@ -11,3 +11,4 @@
t/author-pod-spell.t
t/basic.t
t/release-pod-syntax.t
+t/rt106379-inheritance-corruption.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/META.json
new/Devel-OverloadInfo-0.004/META.json
--- old/Devel-OverloadInfo-0.002/META.json 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/META.json 2015-08-13 18:35:34.000000000
+0200
@@ -4,24 +4,26 @@
"Dagfinn Ilmari Mannsåker <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 5.014, CPAN::Meta::Converter version
2.133380",
+ "generated_by" : "Dist::Zilla version 5.039, CPAN::Meta::Converter version
2.150001",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Devel-OverloadInfo",
"prereqs" : {
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : "6.30"
+ "ExtUtils::MakeMaker" : "0",
+ "perl" : "5.006"
}
},
"develop" : {
"requires" : {
- "Test::Pod" : "1.41"
+ "Test::Pod" : "1.41",
+ "Test::Spelling" : "0.12"
}
},
"runtime" : {
@@ -39,8 +41,11 @@
},
"test" : {
"requires" : {
+ "Test::Fatal" : "0",
"Test::More" : "0.88",
- "parent" : "0"
+ "base" : "0",
+ "parent" : "0",
+ "perl" : "5.006"
}
}
},
@@ -56,6 +61,6 @@
"web" : "https://github.com/ilmari/Devel-OverloadInfo"
}
},
- "version" : "0.002"
+ "version" : "0.004"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/META.yml
new/Devel-OverloadInfo-0.004/META.yml
--- old/Devel-OverloadInfo-0.002/META.yml 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/META.yml 2015-08-13 18:35:34.000000000
+0200
@@ -3,28 +3,32 @@
author:
- 'Dagfinn Ilmari Mannsåker <[email protected]>'
build_requires:
- Test::More: 0.88
- parent: 0
+ Test::Fatal: '0'
+ Test::More: '0.88'
+ base: '0'
+ parent: '0'
+ perl: '5.006'
configure_requires:
- ExtUtils::MakeMaker: 6.30
+ ExtUtils::MakeMaker: '0'
+ perl: '5.006'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.014, CPAN::Meta::Converter version
2.133380'
+generated_by: 'Dist::Zilla version 5.039, CPAN::Meta::Converter version
2.150001'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Devel-OverloadInfo
requires:
- Exporter: 5.57
- MRO::Compat: 0
- Package::Stash: 0.14
- Scalar::Util: 0
- Sub::Identify: 0
- overload: 0
- perl: 5.006
- strict: 0
- warnings: 0
+ Exporter: '5.57'
+ MRO::Compat: '0'
+ Package::Stash: '0.14'
+ Scalar::Util: '0'
+ Sub::Identify: '0'
+ overload: '0'
+ perl: '5.006'
+ strict: '0'
+ warnings: '0'
resources:
bugtracker:
http://rt.cpan.org/Public/Dist/Display.html?Name=Devel-OverloadInfo
repository: git://github.com/ilmari/Devel-OverloadInfo.git
-version: 0.002
+version: '0.004'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/Makefile.PL
new/Devel-OverloadInfo-0.004/Makefile.PL
--- old/Devel-OverloadInfo-0.002/Makefile.PL 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/Makefile.PL 2015-08-13 18:35:34.000000000
+0200
@@ -1,24 +1,20 @@
-
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker
v5.014.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker
v5.039.
use strict;
use warnings;
use 5.006;
-use ExtUtils::MakeMaker 6.30;
-
-
+use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "introspect overloaded operators",
"AUTHOR" => "Dagfinn Ilmari Manns\x{e5}ker <ilmari\@ilmari.org>",
- "BUILD_REQUIRES" => {},
"CONFIGURE_REQUIRES" => {
- "ExtUtils::MakeMaker" => "6.30"
+ "ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Devel-OverloadInfo",
- "EXE_FILES" => [],
"LICENSE" => "perl",
+ "MIN_PERL_VERSION" => "5.006",
"NAME" => "Devel::OverloadInfo",
"PREREQ_PM" => {
"Exporter" => "5.57",
@@ -31,10 +27,12 @@
"warnings" => 0
},
"TEST_REQUIRES" => {
+ "Test::Fatal" => 0,
"Test::More" => "0.88",
+ "base" => 0,
"parent" => 0
},
- "VERSION" => "0.002",
+ "VERSION" => "0.004",
"test" => {
"TESTS" => "t/*.t"
}
@@ -47,7 +45,9 @@
"Package::Stash" => "0.14",
"Scalar::Util" => 0,
"Sub::Identify" => 0,
+ "Test::Fatal" => 0,
"Test::More" => "0.88",
+ "base" => 0,
"overload" => 0,
"parent" => 0,
"strict" => 0,
@@ -65,6 +65,3 @@
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
-
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/README
new/Devel-OverloadInfo-0.004/README
--- old/Devel-OverloadInfo-0.002/README 2014-03-26 13:02:40.000000000 +0100
+++ new/Devel-OverloadInfo-0.004/README 2015-08-13 18:35:34.000000000 +0200
@@ -1,7 +1,7 @@
This archive contains the distribution Devel-OverloadInfo,
-version 0.002:
+version 0.004:
introspect overloaded operators
@@ -11,5 +11,5 @@
the same terms as the Perl 5 programming language system itself.
-This README file was generated by Dist::Zilla::Plugin::Readme v5.014.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.039.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/lib/Devel/OverloadInfo.pm
new/Devel-OverloadInfo-0.004/lib/Devel/OverloadInfo.pm
--- old/Devel-OverloadInfo-0.002/lib/Devel/OverloadInfo.pm 2014-03-26
13:02:40.000000000 +0100
+++ new/Devel-OverloadInfo-0.004/lib/Devel/OverloadInfo.pm 2015-08-13
18:35:34.000000000 +0200
@@ -1,15 +1,15 @@
package Devel::OverloadInfo;
-$Devel::OverloadInfo::VERSION = '0.002';
+$Devel::OverloadInfo::VERSION = '0.004';
# ABSTRACT: introspect overloaded operators
-# =head1 DESCRIPTION
-#
-# Devel::OverloadInfo returns information about L<overloaded|overload>
-# operators for a given class (or object), including where in the
-# inheritance hierarchy the overloads are declared and where the code
-# implementing it is.
-#
-# =cut
+#pod =head1 DESCRIPTION
+#pod
+#pod Devel::OverloadInfo returns information about L<overloaded|overload>
+#pod operators for a given class (or object), including where in the
+#pod inheritance hierarchy the overloads are declared and where the code
+#pod implementing it is.
+#pod
+#pod =cut
use strict;
use warnings;
@@ -20,7 +20,7 @@
use MRO::Compat;
use Exporter 5.57 qw(import);
-our @EXPORT_OK = qw(overload_info);
+our @EXPORT_OK = qw(overload_info is_overloaded);
sub stash_with_symbol {
my ($class, $symbol) = @_;
@@ -33,53 +33,80 @@
return;
}
-# =func overload_info
-#
-# my $info = overload_info($class_or_object);
-#
-# Returns a hash reference with information about all the overloaded
-# operators of the argument, which can be either a class name or a blessed
-# object. The keys are the overloaded operators, as specified in
-# C<%overload::ops> (see L<overload/Overloadable Operations>).
-#
-# =over
-#
-# =item class
-#
-# The name of the class in which the operator overloading was declared.
-#
-# =item code
-#
-# A reference to the function implementing the overloaded operator.
-#
-# =item code_name
-#
-# The name of the function implementing the overloaded operator, as
-# returned by C<sub_fullname> in L<Sub::Identify>.
-#
-# =item method_name (optional)
-#
-# The name of the method implementing the overloaded operator, if the
-# overloading was specified as a named method, e.g. C<< use overload $op
-# => 'method'; >>.
-#
-# =item code_class (optional)
-#
-# The name of the class in which the method specified by C<method_name>
-# was found.
-#
-# =item value (optional)
-#
-# For the special C<fallback> key, the value it was given in C<class>.
-#
-# =back
-#
-# =cut
+#pod =func is_overloaded
+#pod
+#pod if (is_overloaded($class_or_object)) { ... }
+#pod
+#pod Returns a boolean indicating whether the given class or object has any
+#pod overloading declared. Note that a bare C<use overload;> with no
+#pod actual operators counts as being overloaded.
+#pod
+#pod Equivalent to
+#pod L<overload::Overloaded()|overload/overload::Overloaded(arg)>, but
+#pod doesn't trigger various bugs associated with it in versions of perl
+#pod before 5.16.
+#pod
+#pod =cut
+
+sub is_overloaded {
+ my $class = blessed($_[0]) || $_[0];
+
+ # Perl before 5.16 seems to corrupt inherited overload info if
+ # there's a lone dereference overload and overload::Overloaded()
+ # is called before any object has been blessed into the class.
+ return !!("$]" >= 5.016
+ ? overload::Overloaded($class)
+ : stash_with_symbol($class, '&()')
+ );
+}
+
+#pod =func overload_info
+#pod
+#pod my $info = overload_info($class_or_object);
+#pod
+#pod Returns a hash reference with information about all the overloaded
+#pod operators of the argument, which can be either a class name or a blessed
+#pod object. The keys are the overloaded operators, as specified in
+#pod C<%overload::ops> (see L<overload/Overloadable Operations>).
+#pod
+#pod =over
+#pod
+#pod =item class
+#pod
+#pod The name of the class in which the operator overloading was declared.
+#pod
+#pod =item code
+#pod
+#pod A reference to the function implementing the overloaded operator.
+#pod
+#pod =item code_name
+#pod
+#pod The name of the function implementing the overloaded operator, as
+#pod returned by C<sub_fullname> in L<Sub::Identify>.
+#pod
+#pod =item method_name (optional)
+#pod
+#pod The name of the method implementing the overloaded operator, if the
+#pod overloading was specified as a named method, e.g. C<< use overload $op
+#pod => 'method'; >>.
+#pod
+#pod =item code_class (optional)
+#pod
+#pod The name of the class in which the method specified by C<method_name>
+#pod was found.
+#pod
+#pod =item value (optional)
+#pod
+#pod For the special C<fallback> key, the value it was given in C<class>.
+#pod
+#pod =back
+#pod
+#pod =cut
sub overload_info {
my $class = blessed($_[0]) || $_[0];
- return undef unless overload::Overloaded($class);
+ return {} unless is_overloaded($class);
my (%overloaded);
for my $op (map split(/\s+/), values %overload::ops) {
@@ -112,6 +139,14 @@
return \%overloaded;
}
+#pod =head1 CAVEATS
+#pod
+#pod Whether the C<fallback> key exists when it has its default value of
+#pod C<undef> varies between perl versions: Before 5.18 it's there, in
+#pod later versions it's not.
+#pod
+#pod =cut
+
1;
__END__
@@ -126,7 +161,7 @@
=head1 VERSION
-version 0.002
+version 0.004
=head1 DESCRIPTION
@@ -137,6 +172,19 @@
=head1 FUNCTIONS
+=head2 is_overloaded
+
+ if (is_overloaded($class_or_object)) { ... }
+
+Returns a boolean indicating whether the given class or object has any
+overloading declared. Note that a bare C<use overload;> with no
+actual operators counts as being overloaded.
+
+Equivalent to
+L<overload::Overloaded()|overload/overload::Overloaded(arg)>, but
+doesn't trigger various bugs associated with it in versions of perl
+before 5.16.
+
=head2 overload_info
my $info = overload_info($class_or_object);
@@ -178,6 +226,12 @@
=back
+=head1 CAVEATS
+
+Whether the C<fallback> key exists when it has its default value of
+C<undef> varies between perl versions: Before 5.18 it's there, in
+later versions it's not.
+
=head1 AUTHOR
Dagfinn Ilmari Mannsåker <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/t/author-pod-spell.t
new/Devel-OverloadInfo-0.004/t/author-pod-spell.t
--- old/Devel-OverloadInfo-0.002/t/author-pod-spell.t 2014-03-26
13:02:40.000000000 +0100
+++ new/Devel-OverloadInfo-0.004/t/author-pod-spell.t 2015-08-13
18:35:34.000000000 +0200
@@ -10,7 +10,7 @@
use warnings;
use Test::More;
-# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006007
+# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006009
use Test::Spelling 0.12;
use Pod::Wordlist;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Devel-OverloadInfo-0.002/t/basic.t
new/Devel-OverloadInfo-0.004/t/basic.t
--- old/Devel-OverloadInfo-0.002/t/basic.t 2014-03-26 13:02:40.000000000
+0100
+++ new/Devel-OverloadInfo-0.004/t/basic.t 2015-08-13 18:35:34.000000000
+0200
@@ -3,7 +3,7 @@
use warnings;
use Test::More 0.88;
-use Devel::OverloadInfo qw(overload_info);
+use Devel::OverloadInfo qw(overload_info is_overloaded);
sub MyModule::negate { -$_[0] }
@@ -34,6 +34,33 @@
sub stringify { "foo" }
}
+{
+ package # hide from PAUSE
+ EmptyOverload;
+ use overload;
+}
+
+{
+ package # hide from PAUSE
+ InheritedOnly;
+ use parent -norequire => 'BaseClass';
+}
+
+{
+ package # hide from PAUSE
+ NoOverload;
+
+ sub wibble {}
+}
+
+for my $class (qw(BaseClass ChildClass EmptyOverload InheritedOnly)) {
+ ok is_overloaded($class), "$class is overloaded";
+}
+
+for my $class (qw(NoOverload)) {
+ ok !is_overloaded($class), "$class is not overloaded";
+}
+
my $boi = overload_info('BaseClass');
# Whether undef fallback exists varies between perl versions
@@ -100,4 +127,24 @@
},
"ChildClass overload info" or note explain $coi;
+is_deeply overload_info('InheritedOnly'),
+ overload_info('BaseClass'),
+ 'InheritedOnly has same overloads as BaseClass';
+
+is_deeply overload_info('NoOverload'), {},
+ 'NoOverload has no overloads';
+
+my $eoi = overload_info('EmptyOverload');
+
+# Whether undef fallback exists varies between perl versions
+if (my $fallback = delete $eoi->{fallback}) {
+ is_deeply $fallback, {
+ class => 'EmptyOverload',
+ value => undef,
+ }, 'EmptyOverload fallback is undef';
+}
+
+is_deeply $eoi, {},
+ 'EmptyOverload has no overloads';
+
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Devel-OverloadInfo-0.002/t/rt106379-inheritance-corruption.t
new/Devel-OverloadInfo-0.004/t/rt106379-inheritance-corruption.t
--- old/Devel-OverloadInfo-0.002/t/rt106379-inheritance-corruption.t
1970-01-01 01:00:00.000000000 +0100
+++ new/Devel-OverloadInfo-0.004/t/rt106379-inheritance-corruption.t
2015-08-13 18:35:34.000000000 +0200
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Fatal;
+use Devel::OverloadInfo;
+
+{
+ package Foo;
+ # *MUST* be a deref overload standalone, any additional will not do
+ use overload (
+ "&{}" => sub { sub { 42 } },
+ fallback => 1,
+ );
+}
+
+{
+ package SubFoo;
+ # Must have subclass inheriting the overload
+ use base 'Foo';
+}
+
+Devel::OverloadInfo::overload_info('SubFoo');
+
+my $x = bless {}, 'SubFoo';
+
+is exception {
+ ok !!$x, "un-overloaded negation works after inspection before first
bless";
+}, undef, "un-overloaded negation lives after inspection before first bless";
+
+is exception {
+ is $x->(), 42, "overloaded dereference works after inspection before first
bless";
+}, undef, "overloaded dereference lives after inspection before first bless";
+
+done_testing;