in reply to Re: mod_perl and modules (Or "how do I import subs into my PerlHandler module)
in thread mod_perl and modules (Or "how do I import subs into my PerlHandler module)

If you want to refer to subs defined in another package you do have to use the package prefix or import them. That's the perl5 way. There are people who make perl4-style library files with no package declaration that just add their subs to the current package when you use them, but this is a bad practice and should be avoided.

The only mod_perl-specific issue is that if you run your script under Apache::Registry and use the same perl4-style library file in two scripts, the second one to run will not find the subs (because it's in a different package).

  • Comment on Re: Re: mod_perl and modules (Or "how do I import subs into my PerlHandler module)

Replies are listed 'Best First'.
Re: Re: Re: mod_perl and modules (Or "how do I import subs into my PerlHandler module)
by Sihal (Pilgrim) on Nov 22, 2002 at 15:16 UTC
    Hum.
    Well usually everything in @EXPORT is exported by default when under normal use, and only stuff in EXPORT_OOK has to be exported explicitely.
    Apparently (from my experience, but I might do something wrong) under mod_perl, you'd better import everything explicitely else it won't work.
      mod_perl should not affect the behavior of the exporter. I think there must be something else going on.
        Hum, I'm sorry but mod_pel does (?)fiddle with the exporter. It puts all modules under the name Apache::something for example.