From: "Rodney Broom" <[EMAIL PROTECTED]>

> From: "Christopher H. Laco" <[EMAIL PROTECTED]>
> > ...but doesn't Apache actually load happen twice at
> > startup...once for the config parse, once for the real start?
> > 
> > http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_Start
> 
> 
> Good thinking, but it didn't pan out.

Actually, it did pan out, but I missed it.

In apache conf, global or <VirtualHost>, using:
  PerlModule MyApp

runs twice, just as indicated in the doc. Unfortunatelly, mod_perl appears to 
be using a require(), since the compile phase runs in MyApp.pm twice and 
doesn't run import(). I've gotten around this by using a perl block:
  <Perl>
    use lib ...
    use MyApp
  </Perl>

This works just the way you'd expect. The second time MyApp is use'd, the 
package does not go through the compile phase, and only runs my import(). So, 
no more 'redifined' messages.


Before I got that part worked out, I found a bug in 
Catalyst::Utils::ensure_class_loaded(). It wasn't honoring the test to see if 
the package was already loaded in order to skip loading when not needed, and 
thereby loaded packages every time. The problem with this (besides loading with 
require()) is that Module::Pluggable::Object::handle_innerpackages() (called by 
Module::Pluggable::Object::plugins()) grocks through the symbol table for each 
package it has found looking for other packages. The packages it finds (on a 
second compile) include the factory-ized packages under Catalyst::Model::Main. 
ensure_class_loaded() was trying to load these, but they don't exist on disk, 
so it failed.


I'll have patches for at least Catalyst/Utils.pm and Catalyst.pm coming soon.


---
Rodney Broom


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to