From: Bill K. <bi...@ka...> - 2003-02-14 20:03:34
|
>What needs to happen to make my new code recognized? In the default configuration, you need to restart Apache any time you change one of the .pm files. I use Apache::Reload to make changes to .pm files automatically take effect on the next request. Get Apache::Reload from CPAn and put this in httpd.conf: PerlModule Apache::Reload PerlInitHandler Apache::Reload PerlSetVar ReloadAll Off PerlSetVar ReloadModules "InnKit::*" I think changes to Config.xml still require an Apache restart, even when using Apache::Reload. I might be wrong. I have noticed that "apachectl restart" doesn't reload .pm modules into mod_perl reliably, on some operating systems (Solaris, FreeBSD). I have to do "apachectl stop ; sleep 5 ; apachectl start". I made a shell alias for this sequence. >There is no second site for testing. Is there a better way for my testing >code on a live system? I maintain two instances of my application on one server. I keep a separate copy of the whole directory tree. The two trees are very similar, except: 1. Directories "/Model/MyPackage" vs. "/Model/MyPackageTest" (the two apps must have distinct package names). I suppose you could rename the .pm files instead, but I like to have the filenames the same and the directories different, to help me run diffs between the two instances. 2. Config.xml names the packages differently in the model_base_class and model_dispatch_prefix attributes. 3. Config.xml needs a distinct instance id for each copy of the app. <SERVER ID="production"> or <SERVER ID="staging">. 4. I also list my database DSN in the <USER> section of my Config.xml, and I have a separate MySQL database instance for each app instance. My pkit_dbi_connect() routine reads the <USER> config section for the DSN value. 5. Apache's http.conf is set up to point different URL prefixes to each respective copy of the app, and assigns the PKIT_ROOT and PKIT_SERVER variables accordingly. View files, Content files, etc. can all be the same between the two trees. I actually have a couple of differences in my Content files, so there's an indicator to the user of the application which instance they're using. >If there is an error will it affect only the pages involved? No, if there's an error which causes one mod_perl app to fail, it prevents _any_ Apache request from working, including requests for static pages! This sometimes works against me, since I keep my Perl pod files in HTML format on the same server. :-) >Some subroutines have duplicate code in both /Model/InnKit/PageCode.pm >and /Model/InnKit//PageCode/admin.pm. >Both are called in startup.pl. PageCode.pm is first. Wouldn't placing my >code in admin.pm be more appropriate and work as well? I assume admin.pm "ISA" PageCode.pm in your application. Note that admin.pm can call functions in PageCode.pm by calling $model->pageCodeRoutine(). That is, so long as PageCode::pageCodeRoutine takes $model as its first argument. Or have I misunderstood your question? Regards, Bill Karwin |