Re: CGI.pm's -compile/-autoload methods

2000-06-01 Thread Doug MacEachern

 
 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)

doesn't matter if it's shared, it's shared un-needed bloat!  i would use
CGI::compile() instead of use CGI -compile, as gunther suggested.




CGI.pm's -compile/-autoload methods

2000-05-30 Thread Stas Bekman

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.  IWarning: when
I-autoload is in effect, you cannot use "poetry mode"
(functions without the parenthesis).  Use Ihr() rather
than Ihr, or add something like Iuse 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)

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

Thanks!

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

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://perl.org http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org




Re: CGI.pm's -compile/-autoload methods

2000-05-30 Thread Gunther Birznieks

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.  IWarning: when
I-autoload is in effect, you cannot use "poetry mode"
(functions without the parenthesis).  Use Ihr() rather
than Ihr, or add something like Iuse 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/