in reply to Making Class::Std work with mod_perl

But I've noticed that Class::Std doesn't work very well with mod_perl due to the BEGIN{} block it depends on.

Actually it is a CHECK block that is the problem. Because of the way that mod_perl loads code, it does this after the CHECK and INIT phases of the perl compiler have run. This is the code which causes the issue (about line 258 in the lastest version on CPAN):

{ no warnings qw( void ); CHECK { initialize() } }
Now, I am not sure if this version (0.0.8) works with mod_perl or not, but I did find this code on line 417:
Class::Std::initialize(); # Ensure run-time (and mod_perl) setup is +done
So it is possible that this version will work with mod_perl, but even if it does, then it should be possible1, to actually just put that same line of code at the very end of a mod_perl startup.pl file, and things should just work.

(1) - I stress should, because I am not TheDamian, and while I have read over the Class::Std code, I do not profess to understand all it's funky corners and details. However, logic and common sense dictate that if the CHECK block is not run, then just running the same code from the CHECK block should just work. But then again, this is TheDamian we are talking about ;)

-stvn

Replies are listed 'Best First'.
Re^2: Making Class::Std work with mod_perl
by Pic (Scribe) on Mar 05, 2006 at 01:44 UTC

    Oooh. Thank you. That does indeed look mighty promising. This should probably work (once I upgrade my local Class::Std that is).

    Thanks a bunch.