You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/03/31 22:04:03 UTC

Re: Problems with Apache::Reload (Was "Exported methods don't reload under Apache::StatINC")

Garth Webb wrote:
> On Tue, 2004-03-30 at 19:28, Stas Bekman wrote:
> 
>>Garth Webb wrote:
>>
>>>I have a question about Apache::StatINC and reloading exported methods. 
>>
>>Garth, Apache::StatINC is deprecated and no longer maintained. Please use 
>>Apache::Reload instead (mp1 version on CPAN, mp2 version is a part of the core).
>>
>> > Apparently methods that are exported from a module do not get reloaded
>> > when the module changes on disk (see the test script and test module
>> > below).
>>
>>That's right. Please read:
>>http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_With_Reloading_Modules_Which_Do_Not_Declare_Their_Package_Name
> 
> 
> So I've played around with Apache::Reload, and I'm a little confused.  I
> get the same behavior with Apache::Reload that I got under
> Apache::StatINC (i.e. use of exported method names leads to those
> methods not being reloaded), however Apache::Reload doesn't provide any
> way to undef functions which seemed to 'fix' the problem under
> Apache::StatINC.
> 
> The above link to "Problems With Reloading..." doesn't seem to apply
> here since my module does use the correct 'package Module;' line at the
> top.  Furthermore, checking with Apache::Status, I don't see my test
> function imported into the Apache::Reload namespace as it warns with
> modules that don't declare their package.
> 
> Is there a work around for this?  Have I missed something?  If it were
> up to me, all these function calls would be fully qualified, but this is
> a shared code base that has been at my company longer than I have.

Sorry, I've posted the wrong link. It should have been:
http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Problems with Apache::Reload (Was "Exported methods don't reload under Apache::StatINC")

Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> On Wed, 2004-03-31 at 15:04, Stas Bekman wrote:
> 
>>Sorry, I've posted the wrong link. It should have been:
>>http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code
> 
> 
> It doesn't really offer a nice solution though, does it?  It looks to me
> like the best way to handle it is with Apache::Symbol, just like
> Apache::StatINC did.  It looks like you can just add this to your
> Registry script:
> 
>  use Apache::Symbol ();
>  @ISA = qw(Apache::Symbol);
> 
> Or maybe look at the code in StatINC and do the same thing in Reload.
> 
> This is only available for mp 1.x though.

Yes, we started discussing this functionality on the dev list some time ago, 
but it wasn't finished. We certainly need some kind of a similar solution. I 
may try to revive that thread in a few days.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Problems with Apache::Reload (Was "Exported methods don't reload under Apache::StatINC")

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-03-31 at 15:04, Stas Bekman wrote:
> Sorry, I've posted the wrong link. It should have been:
> http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code

It doesn't really offer a nice solution though, does it?  It looks to me
like the best way to handle it is with Apache::Symbol, just like
Apache::StatINC did.  It looks like you can just add this to your
Registry script:

 use Apache::Symbol ();
 @ISA = qw(Apache::Symbol);

Or maybe look at the code in StatINC and do the same thing in Reload.

This is only available for mp 1.x though.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Problems with Apache::Reload (Was "Exported methods don't reload under Apache::StatINC")

Posted by Garth Webb <ga...@zappos.com>.
On Wed, 2004-03-31 at 12:04, Stas Bekman wrote:
> Garth Webb wrote:
> > On Tue, 2004-03-30 at 19:28, Stas Bekman wrote:
> > 
> >>Garth Webb wrote:
> >>
> >>>I have a question about Apache::StatINC and reloading exported methods. 
> >>
> >>Garth, Apache::StatINC is deprecated and no longer maintained. Please use 
> >>Apache::Reload instead (mp1 version on CPAN, mp2 version is a part of the core).
> >>
> >> > Apparently methods that are exported from a module do not get reloaded
> >> > when the module changes on disk (see the test script and test module
> >> > below).
> >>
> >>That's right. Please read:
> >>http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_With_Reloading_Modules_Which_Do_Not_Declare_Their_Package_Name

[snip]

> Sorry, I've posted the wrong link. It should have been:
> http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_with_Scripts_Running_with_Registry_Handlers_that_Cache_the_Code

Shoot, I glanced at that section but was thrown off by the word
'cache'.  It didn't occur to me to think about exported functions in
that way.  Thanks for the help, this all makes sense now!

-- 

 |- Garth Webb       -|
 |- garth@zappos.com -|