r43079 - in /trunk/libmoosex-method-signatures-perl: Changes MANIFEST META.yml Makefile.PL debian/changelog debian/control lib/MooseX/Method/Signatures.pm lib/MooseX/Method/Signatures/Meta/Method.pm t/closure.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Fri Aug 28 01:27:47 UTC 2009
Author: jawnsy-guest
Date: Fri Aug 28 01:27:41 2009
New Revision: 43079
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43079
Log:
+ Provide sane closure behaviour for anonymous methods
* Dependency changes:
+ Now needs Moose >= 0.89
+ Now needs MooseX::Types 0.19
Added:
trunk/libmoosex-method-signatures-perl/t/closure.t
- copied unchanged from r43078, branches/upstream/libmoosex-method-signatures-perl/current/t/closure.t
Modified:
trunk/libmoosex-method-signatures-perl/Changes
trunk/libmoosex-method-signatures-perl/MANIFEST
trunk/libmoosex-method-signatures-perl/META.yml
trunk/libmoosex-method-signatures-perl/Makefile.PL
trunk/libmoosex-method-signatures-perl/debian/changelog
trunk/libmoosex-method-signatures-perl/debian/control
trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures.pm
trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures/Meta/Method.pm
Modified: trunk/libmoosex-method-signatures-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/Changes?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/Changes (original)
+++ trunk/libmoosex-method-signatures-perl/Changes Fri Aug 28 01:27:41 2009
@@ -1,4 +1,13 @@
Version history for MooseX::Method::Signatures
+
+0.23 Thu, 27 Aug 2009 22:22:40 +0200
+ * Bump Moose dependency to 0.89. This avoids test failures on some older
+ Moose versions.
+
+0.22 Thu, 27 Aug 2009 15:29:25 +0200
+ * Provide sane closure behaviour for anonymous methods.
+ * Add tests for the above (Sebastian Willert).
+ * Depend on MooseX::Types 0.19, as 0.18 made us blow up spectacularly.
0.21 Tue, 18 Aug 2009 08:45:48 +0200
* Add tests for using aliased.pm for type aliases (Steffen Schwigon).
Modified: trunk/libmoosex-method-signatures-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/MANIFEST?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/MANIFEST (original)
+++ trunk/libmoosex-method-signatures-perl/MANIFEST Fri Aug 28 01:27:41 2009
@@ -19,6 +19,7 @@
t/attributes.t
t/basic.t
t/caller.t
+t/closure.t
t/declarators.t
t/errors.t
t/eval.t
Modified: trunk/libmoosex-method-signatures-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/META.yml?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/META.yml (original)
+++ trunk/libmoosex-method-signatures-perl/META.yml Fri Aug 28 01:27:41 2009
@@ -23,11 +23,11 @@
B::Hooks::EndOfScope: 0.07
Context::Preserve: 0
Devel::Declare: 0.005011
- Moose: 0.63
+ Moose: 0.89
Moose::Util::TypeConstraints: 0
MooseX::LazyRequire: 0.03
MooseX::Meta::TypeConstraint::ForceCoercion: 0
- MooseX::Types: 0.09
+ MooseX::Types: 0.19
MooseX::Types::Moose: 0
MooseX::Types::Structured: 0.12
Parse::Method::Signatures: 1.003011
@@ -40,4 +40,4 @@
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Method-Signatures
license: http://dev.perl.org/licenses/
repository: git://github.com/rafl/moosex-method-signatures.git
-version: 0.21
+version: 0.23
Modified: trunk/libmoosex-method-signatures-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/Makefile.PL?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/Makefile.PL (original)
+++ trunk/libmoosex-method-signatures-perl/Makefile.PL Fri Aug 28 01:27:41 2009
@@ -11,10 +11,10 @@
requires 'Parse::Method::Signatures' => '1.003011';
requires 'Devel::Declare' => '0.005011';
requires 'Moose::Util::TypeConstraints';
-requires 'Moose' => '0.63';
+requires 'Moose' => '0.89';
requires 'MooseX::LazyRequire' => '0.03';
requires 'MooseX::Meta::TypeConstraint::ForceCoercion';
-requires 'MooseX::Types' => '0.09';
+requires 'MooseX::Types' => '0.19';
requires 'MooseX::Types::Moose';
requires 'MooseX::Types::Structured' => '0.12';
requires 'namespace::autoclean';
Modified: trunk/libmoosex-method-signatures-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/debian/changelog?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/debian/changelog (original)
+++ trunk/libmoosex-method-signatures-perl/debian/changelog Fri Aug 28 01:27:41 2009
@@ -1,14 +1,14 @@
-libmoosex-method-signatures-perl (0.21-1) UNRELEASED; urgency=low
-
- IGNORE-VERSION: 0.21-1
- No release necessary; this feature should be activated automatically
- when the new version of Parse::Method::Signatures is installed
+libmoosex-method-signatures-perl (0.23-1) UNRELEASED; urgency=low
* New upstream release
+ New type alias resolution feature via Parse::Method::Signatures
+ + Provide sane closure behaviour for anonymous methods
+ * Dependency changes:
+ + Now needs Moose >= 0.89
+ + Now needs MooseX::Types 0.19
* Added myself to Uploaders and Copyright
- -- Jonathan Yu <frequency at cpan.org> Fri, 21 Aug 2009 12:23:57 -0400
+ -- Jonathan Yu <frequency at cpan.org> Thu, 27 Aug 2009 17:25:35 -0400
libmoosex-method-signatures-perl (0.20-1) unstable; urgency=low
Modified: trunk/libmoosex-method-signatures-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/debian/control?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/debian/control (original)
+++ trunk/libmoosex-method-signatures-perl/debian/control Fri Aug 28 01:27:41 2009
@@ -3,8 +3,8 @@
Priority: optional
Build-Depends: debhelper (>= 7)
Build-Depends-Indep: perl, libparse-method-signatures-perl (>= 1.003011),
- libmoosex-meta-typeconstraint-forcecoercion-perl, libmoose-perl (>= 0.63),
- libmoosex-types-structured-perl (>= 0.12), libmoosex-types-perl (>= 0.09),
+ libmoosex-meta-typeconstraint-forcecoercion-perl, libmoose-perl (>= 0.89),
+ libmoosex-types-structured-perl (>= 0.12), libmoosex-types-perl (>= 0.19),
libdevel-declare-perl (>= 0.005011), libtask-weaken-perl, libaliased-perl,
libmoosex-lazyrequire-perl (>= 0.03), libtest-simple-perl (>= 0.88),
libtest-exception-perl, libcontext-preserve-perl, libsub-name-perl,
@@ -19,9 +19,9 @@
Package: libmoosex-method-signatures-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libmoosex-types-perl (>= 0.09),
+Depends: ${perl:Depends}, ${misc:Depends}, libmoosex-types-perl (>= 0.19),
libdevel-declare-perl (>= 0.005011), libtask-weaken-perl, libaliased-perl,
- libmoosex-meta-typeconstraint-forcecoercion-perl, libmoose-perl (>= 0.63),
+ libmoosex-meta-typeconstraint-forcecoercion-perl, libmoose-perl (>= 0.89),
libparse-method-signatures-perl (>= 1.003011), libcontext-preserve-perl,
libmoosex-types-structured-perl (>= 0.12), libnamespace-autoclean-perl,
libb-hooks-endofscope-perl (>= 0.07), libsub-name-perl,
Modified: trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures.pm?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures.pm (original)
+++ trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures.pm Fri Aug 28 01:27:41 2009
@@ -19,7 +19,7 @@
use namespace::autoclean;
-our $VERSION = '0.21';
+our $VERSION = '0.23';
has package => (
is => 'ro',
@@ -217,7 +217,7 @@
$args{prototype_injections} = $self->prototype_injections->{injections};
}
- my $method = MooseX::Method::Signatures::Meta::Method->wrap(%args);
+ my $proto_method = MooseX::Method::Signatures::Meta::Method->wrap(%args);
my $after_block = ')';
@@ -232,7 +232,7 @@
$after_block = $name_arg . $after_block . q{;};
}
- my $inject = $method->injectable_code;
+ my $inject = $proto_method->injectable_code;
$inject = $self->scope_injector_call($after_block) . $inject;
$ctx->inject_if_block($inject, "(sub ${attrs} ");
@@ -240,11 +240,12 @@
my $create_meta_method = sub {
my ($code, $pkg, $meth_name, @args) = @_;
subname $pkg . "::" .$meth_name, $code;
- $method->_set_actual_body($code);
- $method->_set_package_name($pkg);
- $method->_set_name($meth_name);
- $method->_adopt_trait_args(@args);
- return $method;
+ return $proto_method->clone(
+ actual_body => $code,
+ package_name => $pkg,
+ name => $meth_name,
+ trait_args => \@args,
+ );
};
if (defined $name) {
Modified: trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures/Meta/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures/Meta/Method.pm?rev=43079&op=diff
==============================================================================
--- trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures/Meta/Method.pm (original)
+++ trunk/libmoosex-method-signatures-perl/lib/MooseX/Method/Signatures/Meta/Method.pm Fri Aug 28 01:27:41 2009
@@ -95,7 +95,6 @@
has actual_body => (
is => 'ro',
isa => CodeRef,
- writer => '_set_actual_body',
predicate => '_has_actual_body',
);
@@ -126,42 +125,39 @@
return $ret;
};
-sub _set_name {
- my ($self, $name) = @_;
- $self->{name} = $name;
-}
-
-sub _set_package_name {
- my ($self, $package_name) = @_;
- $self->{package_name} = $package_name;
-}
-
-sub wrap {
- my ($class, %args) = @_;
-
- $args{actual_body} = delete $args{body}
- if exists $args{body};
-
- my ($to_wrap, $self);
+sub _wrapped_body {
+ my ($class, $self, %args) = @_;
if (exists $args{return_signature}) {
- $to_wrap = sub {
- my @args = $self->validate(\@_);
- return preserve_context { $self->actual_body->(@args) }
+ return sub {
+ my @args = ${ $self }->validate(\@_);
+ return preserve_context { ${ $self }->actual_body->(@args) }
after => sub {
- if (defined (my $msg = $self->_return_type_constraint->validate(\@_))) {
+ if (defined (my $msg = ${ $self }->_return_type_constraint->validate(\@_))) {
confess $msg;
}
};
};
- } else {
- my $actual_body;
- $to_wrap = sub {
- @_ = $self->validate(\@_);
- $actual_body ||= $self->actual_body;
- goto &{ $actual_body };
- };
- }
+ }
+
+ my $actual_body;
+ return sub {
+ @_ = ${ $self }->validate(\@_);
+ $actual_body ||= ${ $self }->actual_body;
+ goto &{ $actual_body };
+ };
+
+}
+
+sub wrap {
+ my ($class, %args) = @_;
+
+ $args{actual_body} = delete $args{body}
+ if exists $args{body};
+
+ my $self;
+ my $to_wrap = $class->_wrapped_body(\$self, %args);
+
if ($args{traits}) {
my @traits = map {
@@ -191,21 +187,21 @@
return $self;
}
-# ok, this is a little lame, as you can't really rely on the normal attribute
-# initialisation within your traits. I suppose we should create the metamethod
-# subclass with its traits here and pass the trait parameters directly to its
-# constructor, throwing away the current "compile-time metamethod" and
-# returning the one that'll be used at runtime. that'd also allow us to get rid
-# of some hacks we currently have, because the metamethod instance persists
-# from compile time to runtme (see _set_name, _set_package_name, etc).
-sub _adopt_trait_args {
- my ($self, %args) = @_;
- while (my ($name, $val) = each %args) {
- my $attr = $self->meta->get_attribute($name);
- confess qq{trying to set non-existant metamethod attribute $name}
- unless $attr;
- $attr->set_initial_value($self, $val);
- }
+sub clone {
+ my ($self, %params) = @_;
+ my $trait_args = delete $params{trait_args};
+
+ my $clone;
+ $clone = $self->meta->clone_object($self,
+ %params, @{ $trait_args || [] },
+ body => $self->_wrapped_body(\$clone,
+ ($self->has_return_signature
+ ? (return_signature => $self->return_signature)
+ : ()),
+ ),
+ );
+
+ return $clone;
}
sub _build_parsed_signature {
More information about the Pkg-perl-cvs-commits
mailing list