From: Aaron Trevena Date: Thu, 17 Apr 2008 19:55:40 +0000 (+0000) Subject: Fixed MODIFY_CODE_ATTRIBUTES and FETCH_CODE_ATTRIBUTES to work with mod_perl threaded... X-Git-Tag: 2.13~7 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=abaae7b29361db768c59f0948815ef07b454bb9b Fixed MODIFY_CODE_ATTRIBUTES and FETCH_CODE_ATTRIBUTES to work with mod_perl threaded model Patch from Ben Hutchings http://rt.cpan.org/Public/Bug/Display.html?id=29984 git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@585 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index b4f75c8..450b760 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -7,19 +7,26 @@ use attributes (); # don't know why this is a global - drb our %remember; -sub MODIFY_CODE_ATTRIBUTES -{ +sub MODIFY_CODE_ATTRIBUTES { shift; # class name not used my ($coderef, @attrs) = @_; - - $remember{$coderef} = \@attrs; - + $remember{$coderef} = [$coderef, \@attrs]; + # previous version took care to return an empty array, not sure why, # but shall cargo cult it until know better return; } -sub FETCH_CODE_ATTRIBUTES { @{ $remember{$_[1]} || [] } } +sub FETCH_CODE_ATTRIBUTES { @{ $remember{$_[1]}->[1] || [] } } + +sub CLONE { + # re-hash %remember + for my $key (keys %remember) { + my $value = delete $remember{$key}; + $key = $value->[0]; + $remember{$key} = $value; + } +} sub process { my ( $class, $r ) = @_;