geektron has asked for the wisdom of the Perl Monks concerning the following question:
i have 2 different apps that use CGI::Application, and i want to reuse some of the common methods ...
after reading A question of inheritance, it might be that the inheritance tree isn't right ... but here's the code in question:
normal setup, no?package FlierAdminReports; use strict; use base qw/ FlierReports /; sub setup { my $self = shift; $self->start_mode( 'options' ); $self->mode_param( 'rm' ); $self->run_modes( options => \&searchOpts, summary => \&orderSummary, ); }
i have a run-mode of 'detail' in FlierReports ( the 'superclass' ) ... but it's not being found.
the attempt is to use the "detail" run mode in the subclass ( FlierAdminReports.pm ), but it get:package FlierReports; use strict; use Data::Dumper; use base qw/ FlierFunctions /; sub setup { my $self = shift; # Setup the run mode stuff $self->start_mode( 'openOrders' ); $self->mode_param( 'rm' ); $self->run_modes( openOrders => \&openOrderSummary, detail => \&openOrderDetail, markDone => \&markFinished, ); }
so i need to export the subroutine? i've tried declaring the run-mode, not declaring the run-mode ( in the subclass )... nothing does "the right thing" ....No such run-mode 'detail' at /usr/lib/perl5/site_perl/5.8.0/CGI/Appli +cation.pm line 133
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Application and inheritance
by Belgarion (Chaplain) on May 19, 2004 at 20:22 UTC | |
by geektron (Curate) on May 19, 2004 at 20:28 UTC | |
|
Re: CGI::Application and inheritance
by dragonchild (Archbishop) on May 19, 2004 at 20:25 UTC | |
by geektron (Curate) on May 19, 2004 at 20:31 UTC |