in reply to That solved it!
in thread Apache::Registry losing subs created via globs.

I just knew that special steps were required to support BEGIN blocks in mod_perl (or any app that embeds Perl) so I thought maybe something special would be required to support INIT as well, and it might not have been done. I've actually never seen an INIT block before. It's a relatively recent addition.

Replies are listed 'Best First'.
Re: Re: That solved it!
by VSarkiss (Monsignor) on Nov 06, 2002 at 23:37 UTC

    This is kinda OT to this thread, but one of the most creative use of INIT blocks I've seen is The BEGINning of the END. MeowChow doesn't seem to hang around these parts too much more, but he wrote some great obfu!

Re: Re: That solved it!
by runrig (Abbot) on Nov 06, 2002 at 23:17 UTC
    I just knew that special steps were required to support BEGIN blocks in mod_perl.. I recreated the problem outside of mod_perl, so that's not the problem...though I hadn't heard of an INIT block. It must just be how INIT blocks get handled under Apache::Registry-like conditions.

    Update: Aha, now I see INIT in perlcompile and perlmod.

      I don't think it's related to the wrapping of code used in Apache::Registry because the module that contains the INIT block is not modified at all; only the actual CGI file is. The module with the INIT is just pulled in via a "use" from the CGI.
Re^2: That solved it!
by Aristotle (Chancellor) on Nov 06, 2002 at 23:52 UTC

    It's been around for quite a while actually (it was in Camel 2), but it's not really useful the vast majority of the time, since it is called just prior to execution but after compilation, so that it can't affect that. Choosing a BEGIN block of an INIT block is rarely wrong - the opposite case would quite frequently be.

    I guess it's one of those things that you almost never need, but are very useful in that one out of 100,000 cases where you do.

    Makeshifts last the longest.