But, using setup for authentication is, as far as I could get it from the docs, the wrong place to do it. Use cgiapp_prerun instead.
There are some slides showing this at http://cgiapp.erlbaum.net/index.cgi?ArticlesAndTutorials I used this and made a working template for testing purposes. See the following code. HTH, Alex [code] #!/usr/bin/perl package CatcherInTheRye; use strict; use warnings; use base qw/CGI::Application/; use CGI::Application::Plugin::Forward; use CGI::Application::Plugin::Redirect; use CGI::Application::Plugin::ValidateRM; use CGI::Application::Plugin::ConfigAuto (qw/cfg/); use CGI::Application::Plugin::DBH (qw/dbh_config dbh/); # for development use CGI::Application::Plugin::DBIProfile; use Data::Dumper qw/Dumper/; =head1 NAME CatcherInTheRye - Perl extension for blah blah blah =head1 SYNOPSIS use CatcherInTheRye; blah blah blah =head1 DESCRIPTION Stub documentation for CatcherInTheRye, created by h2xs. It looks like the author of the extension was negligent enough to leave the stub unedited. Blah blah blah. =head2 EXPORT None by default. =head1 METHODS =cut =head2 cgiapp_init() Open database connection, setup config files, etc. =cut sub cgiapp_init { my $self = shift; # Set some defaults for DFV unless they already exist. $self->param('dfv_defaults') || $self->param('dfv_defaults', { missing_optional_valid => 1, filters => 'trim', msgs => { any_errors => 'some_errors', prefix => 'err_', invalid => 'Invalid', missing => 'Missing', format => '<span class="dfv-errors">%s</span>', }, }); } # /cgiapp_init =head2 setup() Defined runmodes, etc. =cut sub setup { my $self = shift; $self->start_mode('start'); $self->run_modes([qw/ start /]); } # /setup =head2 cgiapp_prerun() We know what the runmode will be. Do we want to do anything about it? =over =item Authentication? =item Authorization? =item Redirection? =back =cut sub cgiapp_prerun { my $self = shift; } # /cgiapp_prerun =head2 cgiapp_get_query() Bote: uploads are disabled by default in CGI::Simple. =cut sub cgiapp_get_query { require CGI::Simple; my $q = new CGI::Simple; return $q; } # /cgiapp_get_query =head2 start() =cut sub start { my $self = shift; return 'start'; } # /start =head2 cgiapp_postrun() Output manipulation: =over =item add common header/footer? =item Cleanup your HTML? =item Rewrite URLs? =back =cut sub cgiapp_postrun { my $self = shift; my $output = shift; } # /cgiapp_postrun =head2 teardown() Close database connections (if not persistant), flush out session storage, etc. =cut sub teardown { my $self = shift; } # /teardown =head1 SEE ALSO Mention other useful documentation such as the documentation of related modules or operating system documentation (such as man pages in UNIX), or any relevant external documentation such as RFCs or standards. If you have a mailing list set up for your module, mention it here. If you have a web site set up for your module, mention it here. =head1 AUTHOR A. U. Thor, E<lt>[email protected]<gt> =head1 COPYRIGHT AND LICENSE Copyright (C) 2009 by A. U. Thor This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. =cut 1; use strict; use warnings; my $app = CatcherInTheRye->new(); $app->run(); [/code] -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Peters Sent: Mittwoch, 5. August 2009 20:09 To: CGI Application Subject: Re: [cgiapp] Re: error subclassing CGIApp P Kishor wrote: > So, I think I have discovered an answer to my problem -- seems like I > can't have setup in BaseCGIApp. Sure you can. You just need to make sure that you call your base class's setup() method in your child classes if you're overridding it. This is pretty standard OO: sub setup { my $self = shift; $self->SUPER::setup(); # now do my own stuff } -- Michael Peters Plus Three, LP ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################ Eingehende eMail ist virenfrei. Von AVG überprüft - www.avg.de Version: 8.5.392 / Virendatenbank: 270.13.44/2283 - Ausgabedatum: 08/05/09 05:57:00 ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################
