diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-02-03 12:44:08 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-02-03 12:44:08 +0000 |
commit | bf662cc38c080f1658ebd56543330f7ca0e07269 (patch) | |
tree | 0dbe67c28e4584cb55304af6cf8d4adb2367b605 /lib/Reaction/Class.pm | |
parent | 6a531d965cddbd184768ec04f65339b359652eb1 (diff) | |
download | reaction-bf662cc38c080f1658ebd56543330f7ca0e07269.tar.gz reaction-bf662cc38c080f1658ebd56543330f7ca0e07269.zip |
make delayed setup components work so implements+does with required methods in the role works
Diffstat (limited to 'lib/Reaction/Class.pm')
-rw-r--r-- | lib/Reaction/Class.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Reaction/Class.pm b/lib/Reaction/Class.pm index 7813f48..64116ce 100644 --- a/lib/Reaction/Class.pm +++ b/lib/Reaction/Class.pm @@ -147,15 +147,20 @@ sub setup_and_cleanup { shift if $_[0] eq 'as'; push(@methods, [ $name, shift ]); }; + my $s = $setup; foreach my $meth ($self->delayed_methods) { $save_delayed{$meth} = $package->can($meth); - local *{"${package}::${meth}"} = - Sub::Name::subname "${self}::${meth}" => sub { - push(@apply_after, [ $meth => @_ ]); - }; + my $s_copy = $s; + $s = sub { + local *{"${package}::${meth}"} = + Sub::Name::subname "${self}::${meth}" => sub { + push(@apply_after, [ $meth => @_ ]); + }; + $s_copy->(@_); + }; } # XXX - need additional fuckery to handle multi-class-per-file - $setup->(); # populate up the crap + $s->(); # populate up the crap } my %exports = $self->exports_for_package($package); { |