It is strongly targetted at classic process-per-request CGI environments. It tries to avoid compiling too much by implicitly require-ing subclasses in the dispatcher, and stores request-specific data in slots of the main object, which are effectively global variables.Now we can read Randal's feelings on this topic: Although the name CGI::Prototype implies a CGI protocol, I see no reason that this would not work with Apache::Registry in a mod_perl environment, or a direct content handler such as:
Note that the $r request object will have to be created if needed if you use this approach.package My::App; use base CGI::Prototype; sub handler { __PACKAGE__->activate; }
and then you setup the CGI instance in the 'object':our $_mirror = __PACKAGE__->reflect; # for slots that aren't subs
but the 'object' is in fact a package variable, which makes mod_perl usage subject to variable stomping...sub initialize_CGI { my $self = shift; $self->reflect->addSlot ([qw(CGI FIELD autoload)] => sub { require CGI; CGI::_reset_globals(); CGI->new; }); }
So we see that aristotle hit the nail on the head. And even though CGI::Prototype is wonderful for CGI, it needs some serious revamping for use in a mod_perl environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Prototype criticism 2 - CGI-oriented... but can it please all web setups?
by jagh (Monk) on Dec 20, 2008 at 07:41 UTC | |
by Your Mother (Archbishop) on Dec 20, 2008 at 08:52 UTC | |
|
Re: CGI::Prototype criticism 2 - CGI-oriented... but can it please all web setups?
by jeffa (Bishop) on Dec 19, 2008 at 17:11 UTC |