At 03:16 AM 5/31/00 +0300, you wrote:
>I've suggested using:
>
>  use CGI qw(-compile :all);
>
>in the Guide for a long time. Now I've read the following:
>
><QUOTE CGI.pm>
>=item -compile
>
>This causes the indicated autoloaded methods to be compiled up front,
>rather than deferred to later.  This is useful for scripts that run
>for an extended period of time under FastCGI or mod_perl, and for
>those destined to be crunched by Malcom Beattie's Perl compiler.  Use
>it in conjunction with the methods or method families you plan to use.
>
>    use CGI qw(-compile :standard :html3);
>
>or even
>
>    use CGI qw(-compile :all);
>
>Note that using the -compile pragma in this way will always have
>the effect of importing the compiled functions into the current
>namespace.  If you want to compile without importing use the
>compile() method instead (see below).
>
>=item -autoload
>
>This overrides the autoloader so that any function in your program
>that is not recognized is referred to CGI.pm for possible evaluation.
>This allows you to use all the CGI.pm functions without adding them to
>your symbol table, which is of concern for mod_perl users who are
>worried about memory consumption.  I<Warning:> when
>I<-autoload> is in effect, you cannot use "poetry mode"
>(functions without the parenthesis).  Use I<hr()> rather
>than I<hr>, or add something like I<use subs qw/hr p header/>
>to the top of your script.
></QUOTE>
>
>Two questions:
>
>1. regarding -compile, if the tags are imported into the startup.pl's
>package or main:: they aren't inhereted by child processes and therefore
>not adding some memory size to the total child process size, am I right?
>(well it's shared anyway)

Yes. The names would only be loaded in the namespace that the use with the 
compile flag was done. In theory.

If you were really hyper about the namespace stuff, you could probably 
write a CGI.pm loader package that wrapped around the use of CGI.pm and 
then after loading the methods, it would clear out its own namespace using 
a routine similar to Apache::PerlRun's.... But I don't think it would be 
worth it.

>2. regarding -autoload. Do any of you use it? Is it really useful, isn't
>it adding an overhead of AUTOLOAD?

I always stick to using the OO interface for everything I personally do. I 
do feel it does make my code look more consistent since I use objects for 
other stuff.

Later,
    Gunther



>P.S. Lincoln is on the Perl Cruise in Alaska so I don't expect to hear
>from him in the next 2 weeks...

Nice!


__________________________________________________
Gunther Birznieks ([EMAIL PROTECTED])
Extropia - The Web Technology Company
http://www.extropia.com/

Reply via email to