r75803 - in /branches/upstream/libmoo-perl/current: ./ lib/ lib/Method/Generate/ lib/Moo/ lib/Role/ lib/Sub/ maint/ t/
fabreg-guest at users.alioth.debian.org
fabreg-guest at users.alioth.debian.org
Wed Jun 15 21:17:22 UTC 2011
Author: fabreg-guest
Date: Wed Jun 15 21:17:19 2011
New Revision: 75803
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75803
Log:
[svn-upgrade] new version libmoo-perl (0.009008)
Added:
branches/upstream/libmoo-perl/current/t/load_module_role_tiny.t
Modified:
branches/upstream/libmoo-perl/current/Changes
branches/upstream/libmoo-perl/current/MANIFEST
branches/upstream/libmoo-perl/current/META.yml
branches/upstream/libmoo-perl/current/Makefile.PL
branches/upstream/libmoo-perl/current/lib/Method/Generate/Accessor.pm
branches/upstream/libmoo-perl/current/lib/Moo.pm
branches/upstream/libmoo-perl/current/lib/Moo/_Utils.pm
branches/upstream/libmoo-perl/current/lib/Role/Tiny.pm
branches/upstream/libmoo-perl/current/lib/Sub/Quote.pm
branches/upstream/libmoo-perl/current/maint/Makefile.PL.include
branches/upstream/libmoo-perl/current/t/accessor-weaken.t
branches/upstream/libmoo-perl/current/t/load_module.t
branches/upstream/libmoo-perl/current/t/sub-quote.t
Modified: branches/upstream/libmoo-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/Changes?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/Changes (original)
+++ branches/upstream/libmoo-perl/current/Changes Wed Jun 15 21:17:19 2011
@@ -1,3 +1,7 @@
+0.009008 - 2011-06-03
+ - transfer fix to _load_module to Role::Tiny and make a note it's an inline
+ - Bring back 5.8.1 compat
+
0.009007 - 2011-02-25
- I botched the copyright. re-disting.
Modified: branches/upstream/libmoo-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/MANIFEST?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/MANIFEST (original)
+++ branches/upstream/libmoo-perl/current/MANIFEST Wed Jun 15 21:17:19 2011
@@ -29,6 +29,7 @@
t/compose-roles.t
t/extends-non-moo.t
t/load_module.t
+t/load_module_role_tiny.t
t/method-generate-accessor.t
t/method-generate-constructor.t
t/moo-accessors.t
Modified: branches/upstream/libmoo-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/META.yml?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/META.yml (original)
+++ branches/upstream/libmoo-perl/current/META.yml Wed Jun 15 21:17:19 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Moo
-version: 0.009007
+version: 0.009008
abstract: Minimalist Object Orientation (with Moose compatiblity)
author:
- mst - Matt S. Trout (cpan:MSTROUT) <mst at shadowcat.co.uk>
Modified: branches/upstream/libmoo-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/Makefile.PL?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/Makefile.PL (original)
+++ branches/upstream/libmoo-perl/current/Makefile.PL Wed Jun 15 21:17:19 2011
@@ -1,6 +1,6 @@
use strict;
use warnings FATAL => 'all';
-use 5.008003;
+use 5.008001;
use ExtUtils::MakeMaker;
(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
Modified: branches/upstream/libmoo-perl/current/lib/Method/Generate/Accessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/lib/Method/Generate/Accessor.pm?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/lib/Method/Generate/Accessor.pm (original)
+++ branches/upstream/libmoo-perl/current/lib/Method/Generate/Accessor.pm Wed Jun 15 21:17:19 2011
@@ -336,9 +336,33 @@
my ($self, $me, $name, $spec, $value) = @_;
my $name_str = perlstring $name;
my $simple = "${me}->{${name_str}} = ${value}";
+
if ($spec->{weak_ref}) {
require Scalar::Util;
- "Scalar::Util::weaken(${simple})";
+
+ # Perl < 5.8.3 can't weaken refs to readonly vars
+ # (e.g. string constants). This *can* be solved by:
+ #
+ #Internals::SetReadWrite($foo);
+ #Scalar::Util::weaken ($foo);
+ #Internals::SetReadOnly($foo);
+ #
+ # but requires XS and is just too damn crazy
+ # so simply throw a better exception
+ Moo::_Utils::lt_5_8_3() ? <<"EOC" : "Scalar::Util::weaken(${simple})";
+
+ eval { Scalar::Util::weaken($simple); 1 } or do {
+ if( \$@ =~ /Modification of a read-only value attempted/) {
+ require Carp;
+ Carp::croak( sprintf (
+ 'Reference to readonly value in "%s" can not be weakened on Perl < 5.8.3',
+ $name_str,
+ ) );
+ } else {
+ die \$@;
+ }
+ };
+EOC
} else {
$simple;
}
Modified: branches/upstream/libmoo-perl/current/lib/Moo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/lib/Moo.pm?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/lib/Moo.pm (original)
+++ branches/upstream/libmoo-perl/current/lib/Moo.pm Wed Jun 15 21:17:19 2011
@@ -3,7 +3,7 @@
use strictures 1;
use Moo::_Utils;
-our $VERSION = '0.009007'; # 0.9.7
+our $VERSION = '0.009008'; # 0.9.8
$VERSION = eval $VERSION;
our %MAKERS;
Modified: branches/upstream/libmoo-perl/current/lib/Moo/_Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/lib/Moo/_Utils.pm?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/lib/Moo/_Utils.pm (original)
+++ branches/upstream/libmoo-perl/current/lib/Moo/_Utils.pm Wed Jun 15 21:17:19 2011
@@ -2,6 +2,13 @@
sub _getglob { \*{$_[0]} }
sub _getstash { \%{"$_[0]::"} }
+
+BEGIN {
+ *lt_5_8_3 = $] < 5.008003
+ ? sub () { 1 }
+ : sub () { 0 }
+ ;
+}
use strictures 1;
use base qw(Exporter);
@@ -20,6 +27,8 @@
}
our %MAYBE_LOADED;
+
+# _load_module is inlined in Role::Tiny - make sure to copy if you update it.
sub _load_module {
(my $proto = $_[0]) =~ s/::/\//g;
Modified: branches/upstream/libmoo-perl/current/lib/Role/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/lib/Role/Tiny.pm?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/lib/Role/Tiny.pm (original)
+++ branches/upstream/libmoo-perl/current/lib/Role/Tiny.pm Wed Jun 15 21:17:19 2011
@@ -1,6 +1,7 @@
package Role::Tiny;
sub _getglob { \*{$_[0]} }
+sub _getstash { \%{"$_[0]::"} }
use strict;
use warnings FATAL => 'all';
@@ -9,9 +10,14 @@
our %APPLIED_TO;
our %COMPOSED;
+# inlined from Moo::_Utils - update that first.
+
sub _load_module {
- return 1 if $_[0]->can('can');
(my $proto = $_[0]) =~ s/::/\//g;
+ return 1 if $INC{"${proto}.pm"};
+ # can't just ->can('can') because a sub-package Foo::Bar::Baz
+ # creates a 'Baz::' key in Foo::Bar's symbol table
+ return 1 if grep !/::$/, keys %{_getstash($_[0])||{}};
require "${proto}.pm";
return 1;
}
Modified: branches/upstream/libmoo-perl/current/lib/Sub/Quote.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/lib/Sub/Quote.pm?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/lib/Sub/Quote.pm (original)
+++ branches/upstream/libmoo-perl/current/lib/Sub/Quote.pm Wed Jun 15 21:17:19 2011
@@ -173,7 +173,7 @@
=head2 quote_sub
- my $coderef = quote_sub 'Foo:bar', q{ print $x++ . "\n" }, { '$x' => \0 };
+ my $coderef = quote_sub 'Foo::bar', q{ print $x++ . "\n" }, { '$x' => \0 };
Arguments: ?$name, $code, ?\%captures, ?\%options
Modified: branches/upstream/libmoo-perl/current/maint/Makefile.PL.include
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/maint/Makefile.PL.include?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/maint/Makefile.PL.include (original)
+++ branches/upstream/libmoo-perl/current/maint/Makefile.PL.include Wed Jun 15 21:17:19 2011
@@ -1,3 +1,4 @@
+use lib 'distar/lib';
use Distar;
author 'mst - Matt S. Trout (cpan:MSTROUT) <mst at shadowcat.co.uk>';
Modified: branches/upstream/libmoo-perl/current/t/accessor-weaken.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/t/accessor-weaken.t?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/t/accessor-weaken.t (original)
+++ branches/upstream/libmoo-perl/current/t/accessor-weaken.t Wed Jun 15 21:17:19 2011
@@ -9,11 +9,29 @@
has one => (is => 'ro', weak_ref => 1);
}
-my $ref = \'yay';
+my $ref = {};
+my $foo = Foo->new(one => $ref);
+is($foo->one, $ref, 'value present');
+ok(Scalar::Util::isweak($foo->{one}), 'value weakened');
+undef $ref;
+ok (!defined $foo->{one}, 'weak value gone');
-my $foo = Foo->new(one => $ref);
+# test readonly SVs
+sub mk_ref { \ 'yay' };
+my $foo_ro = eval { Foo->new(one => mk_ref()) };
+if ($] < 5.008003) {
+ like(
+ $@,
+ qr/\QReference to readonly value in "one" can not be weakened on Perl < 5.8.3/,
+ 'Expected exception thrown on old perls'
+ );
+}
+else {
+ is(${$foo_ro->one},'yay', 'value present');
+ ok(Scalar::Util::isweak($foo_ro->{one}), 'value weakened');
-is(${$foo->one},'yay', 'value present');
-ok(Scalar::Util::isweak($foo->{one}), 'value weakened');
+ { no warnings 'redefine'; *mk_ref = sub {} }
+ ok (!defined $foo_ro->{one}, 'optree reaped, ro static value gone');
+}
done_testing;
Modified: branches/upstream/libmoo-perl/current/t/load_module.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/t/load_module.t?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/t/load_module.t (original)
+++ branches/upstream/libmoo-perl/current/t/load_module.t Wed Jun 15 21:17:19 2011
@@ -1,6 +1,10 @@
+# this test is replicated to t/load_module_role_tiny.t for Role::Tiny
+
+# work around RT#67692
+use Moo::_Utils;
use strictures 1;
+
use Test::More;
-use Moo::_Utils;
local @INC = (sub {
return unless $_[1] eq 'Foo/Bar.pm';
Added: branches/upstream/libmoo-perl/current/t/load_module_role_tiny.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/t/load_module_role_tiny.t?rev=75803&op=file
==============================================================================
--- branches/upstream/libmoo-perl/current/t/load_module_role_tiny.t (added)
+++ branches/upstream/libmoo-perl/current/t/load_module_role_tiny.t Wed Jun 15 21:17:19 2011
@@ -1,0 +1,20 @@
+# this test is replicated to t/load_module.t for Moo::_Utils
+
+use Role::Tiny ();
+use strictures 1;
+use Test::More;
+
+local @INC = (sub {
+ return unless $_[1] eq 'Foo/Bar.pm';
+ my $source = "package Foo::Bar; sub baz { 1 } 1";
+ open my $fh, '<', \$source;
+ $fh;
+}, @INC);
+
+{ package Foo::Bar::Baz; sub quux { } }
+
+Role::Tiny::_load_module("Foo::Bar");
+
+ok(eval { Foo::Bar->baz }, 'Loaded module ok');
+
+done_testing;
Modified: branches/upstream/libmoo-perl/current/t/sub-quote.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoo-perl/current/t/sub-quote.t?rev=75803&op=diff
==============================================================================
--- branches/upstream/libmoo-perl/current/t/sub-quote.t (original)
+++ branches/upstream/libmoo-perl/current/t/sub-quote.t Wed Jun 15 21:17:19 2011
@@ -21,7 +21,7 @@
my $u_one = unquote_sub $one;
is_deeply(
- [ keys %EVALED ], [ qw(one two) ],
+ [ sort keys %EVALED ], [ qw(one two) ],
'Both subs evaled'
);
More information about the Pkg-perl-cvs-commits
mailing list