perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Nagel ...@thomasnagel.com>
Subject Re: "use overload" with Apache2::Reload
Date Tue, 13 Jun 2006 16:15:37 GMT
Anthony Heading wrote:
> The "+" operator, defined using an anonymous sub, works perfectly. The
> comparison operators work fine _until_ MyClass.pm is changed; but they
> then give errors like "Not a CODE reference at <calling module line>".

Just a guess, maybe I am wrong:
-------------------------------

overload.pm seems to handle anonymous subs and sub references different:

package MyClass;
use overload '""' => \&stringify;
seems to be called as a reference to Blah::stringify while

use overload '""' => sub { "blah" }
seems to hold and call the sub ref in place.


So maybe:
---------

(1) MyClass is changed and therefore recompiled

(2) Another handler uses MyClass but

http://perl.apache.org/docs/2.0/api/Apache2/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code

(3) therefore MyClass::stringify reference points to a non-existing code
    location (Not a CODE reference at..)

(4) The in place anonymous sub works but maybe with the old results as the
    sub is still 'in place' and can be called directly


Again: only a guess ;-)


-Thomas





Mime
View raw message