Re: [cgi-prototype-users] CGIP and eager loading of Template and CGI in mod_perl-like environments

2005-10-29 Thread Terrence Brannon
On 10/29/05, A. Pagaltzis <[EMAIL PROTECTED]> wrote:
* Randal L. Schwartz  [2005-10-29 16:50]:> You can probably automate that if you wanted.  I'm sure you can> come up with a BEGIN block that reads the directory and loads
> all the plugins.Cf. Module::Pluggable.
Yes, also:

http://search.cpan.org/~drolsky/Class-Factory-Util-1.6/lib/Class/Factory/Util.pm 





Re: [cgi-prototype-users] CGIP and eager loading of Template and CGI in mod_perl-like environments

2005-10-29 Thread A. Pagaltzis
* Randal L. Schwartz  [2005-10-29 16:50]:
> You can probably automate that if you wanted.  I'm sure you can
> come up with a BEGIN block that reads the directory and loads
> all the plugins.

Cf. Module::Pluggable.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;


---
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
___
cgi-prototype-users mailing list
cgi-prototype-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users


Re: [cgi-prototype-users] CGIP and eager loading of Template and CGI in mod_perl-like environments

2005-10-29 Thread Randal L. Schwartz
> "Terrence" == Terrence Brannon <[EMAIL PROTECTED]> writes:

Terrence> I just wanted to start a discussion about usage of CGIP in mod_perl
Terrence> environments. I am happy with CGIP's setup for my webhosting stuff, 
because
Terrence> we use plain CGI. However, for corporate work (should that day come), 
the
Terrence> fact that the engine slot and the prototype_enter method use 
autoloads to
Terrence> load Template and CGI would compromise performance: one would prefer 
that
Terrence> both of these be loaded eagerly.

It would be enough to simply list them literally:

use My::App;
use My::App::PageOne;
use My::App::PageTwo;
etc

You can probably automate that if you wanted.  I'm sure you can come
up with a BEGIN block that reads the directory and loads all the
plugins.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


---
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
___
cgi-prototype-users mailing list
cgi-prototype-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users


[cgi-prototype-users] CGIP and eager loading of Template and CGI in mod_perl-like environments

2005-10-29 Thread Terrence Brannon
I just wanted to start a discussion about usage of CGIP in mod_perl
environments. I am happy with CGIP's setup for my webhosting stuff,
because we use plain CGI. However, for corporate work (should that day
come), the fact that the engine slot and the prototype_enter method use
autoloads to load Template and CGI would compromise performance: one
would prefer that both of these be loaded eagerly.

So, since there is no class supplied with the CGIP distro by default
which handles this (should there be?), I think the approach is obvious:

In the startup.pl or whatever pre-loaded handler you will use simply do 
use Template; 
use CGI;

use base qw(CGI::Prototype);

BEGIN {  

# _reset_globals is discussed here: http://use.perl.org/~merlyn/journal/24641
CGI::_reset_globals(); 
my $cgi = CGI->new 

}

sub engine {
 my $self = shift;
 # no longer needed: require Template;
 Template->new($self->engine_config)
   or die "Creating tt: $Template::ERROR\n";
   });

sub CGI {
 $cgi
 });