Re: [mp2] Apache2::Reload doesn't reload

2007-07-10 Thread Perrin Harkins

On 6/27/07, Colin Wetherbee [EMAIL PROTECTED] wrote:

I have a handler in a module called JetSet::Handler.  That module
depends on a number of other modules, which I've tried to include with
'use', with limited success.  It seems, sometimes, symbols act just fine
and reload when they should, but other times, I have to restart Apache
in order to get the symbols to reload.


You have to understand, Perl has no support for reloading modules.
What Reload and similar modules do (clearing the symbol table and %INC
and loading the module again) usually works, but it's never going to
be work for 100% of all perl code because it's not an actual language
feature.


# In Handler.pm:
require JetSet::Debug; JetSet::Debug-import();
# ...
   JetSet::Debug::DebugLevel(JetSet::Debug::DEBUG_WARN);
# End


Why import it at all if you're going to fully qualify it like that?
Is this your actual code?


# From error_log:
failed to resolve handler `JetSet::Handler': Bareword
JetSet::Debug::DEBUG_WARN not allowed while strict subs in use at
/home/cww/sites/rain/htdocs/jet-set/JetSet/Handler.pm line 19.


You can declare the sub names with the use subs pragma.  Adding
parentheses on the end of DEBUG_WARN might help too.


I'm not opposed to doing that, but in that case, how does one deal with
things like constants?


I think what you're really asking here is how do you handle
configuring your application.  There are many ways to do it.  I
usually end up having a configuration object of some kind, usually
implemented as a singleton.  And yes, I restart when I want to change
them.  It's fairly easy to implement a periodic check for changes in
your config file though, if you want to.  Things like Log4Perl have
this built in.

Or, if you really did mean constants, I put them in the files where
they are used, and never touch them, since they are... constants.

- Perrin


Re: [mp2] Apache2::Reload doesn't reload

2007-06-27 Thread Jonathan Vanasco


I've found Reload to work poorly on the handler sub -- i haven't been  
able to figure out why, but it just works poorly.


To get around that, I just have the handler call/wrap other subs.


package myapp;

sub handler {
$page= myapp::Page-new();
$page-whatever;
}


any changes go into myapp Page, or other modules.

i never have to worry about the reload issues on the handler.  pretty  
simple.








// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -





Re: [mp2] Apache2::Reload doesn't reload

2007-06-27 Thread Colin Wetherbee

Jonathan Vanasco wrote:

sub handler {
$page= myapp::Page-new();
$page-whatever;
}


So, Page.pm defines an object... do you have Page.pm including other 
Exporter-style modules?  And, do those work properly?


Thanks.

Colin