Permalink
Browse files

tweak how args are passed to composed methods

  • Loading branch information...
1 parent 241869b commit 737d6ebfd0a1445be53713e2dee49b6ab5104909 @rjbs committed Nov 3, 2010
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/MooseX/ComposedBehavior.pm
  2. +4 −4 lib/MooseX/ComposedBehavior/Stub.pm
@@ -43,8 +43,8 @@ sub _build_composed_behavior {
$stub_name,
sub {
my ($orig, $self, $arg, $col) = @_;
- my @array;
- push @array, (wantarray
+
+ my @array = (wantarray
? $self->$code(@$arg)
: scalar $self->$code(@$arg)
);
@@ -14,11 +14,11 @@ parameter method_name => (
);
subtype 'MooseX::ComposedBehavior::Stub::_MethodList',
- as 'ArrayRef[Str]';
+ as 'ArrayRef[Str|CodeRef]';
coerce 'MooseX::ComposedBehavior::Stub::_MethodList',
- from 'Str',
- via { [$_] };
+ from 'CodeRef', via { [$_] },
+ from 'Str', via { [$_] };
parameter also_compose => (
isa => 'MooseX::ComposedBehavior::Stub::_MethodList',
@@ -52,7 +52,7 @@ role {
if (defined $also_compose) {
for my $also_method (@$also_compose) {
push @$results, (wantarray
- ? [ $self->$also_method ] : scalar $self->$also_method);
+ ? [ $self->$also_method(@_) ] : scalar $self->$also_method(@_));
}
}

0 comments on commit 737d6eb

Please sign in to comment.