Adam --

> Am I correct in assuming that, you need one instance script for each
> CGI::App package.

Yes. The real power of CGI::App shows through when you write a re-usable
module, so that can be used from two or more instance scripts at the
same time. You might do this when you want to present the same
application, but with a different template look or configuration
variables in place.

> You call the instance script every time you want to access any of the run
> modes in the package, if you pass a run mode into the instance script it
> runs that run mode, if you do not pass in a run mode, it uses the default
> start run mode.
> 
> The run mode needs to be specified as rm=run_mode.

All correct.
 
> Also what happens when a run mode is specified but does not exist in the
> package.

First, you have the option of handling the case. With an AUTOLOAD
routine. If that doesn't return output or is missing, your webserver
likely display the "500", Internal Server Error message. I use a generic  
AUTOLOAD in all my CGI::App modules to simply return a message that the
desired 'page' could not be found. It looks something like this:

AUTOLOAD => sub {
        my $self = shift;
        return $self->error(title=>'Page not found', msg=> "(runmode tried was: 
".$self->query->param('rm').")")
}

This is referencing an "error" run mode, that just fills in a basic template and 
returns it.

        Mark

--
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to