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

In reply to Re: Making Class::Std work with mod_perl by stvn
in thread Making Class::Std work with mod_perl by Pic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.