----- Original Message -----
From: "Ed Pigg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, April 29, 2006 1:48 PM
Subject: [cgiapp] More base class questions
> I've split my application run modes into several modules and a base
> class.
>
> myapp.pm
> somestuff.pm
> someotherstuff.pm
>
> I want to put the common code in the base class. Session management -
> CGI::Application::Plugin::Session, Authentication -
> CGI::Application::Plugin::Authentication, etc..
>
> I'm having a problem getting the derived modules to call base class
> methods. Do I need to export the methods?
>
> package myapp::Base;
>
> use strict;
> use warnings;
> use CGI::Application::Plugin::Session;
> use CGI::Application::Plugin::Authentication;
> use base 'CGI::Application';
>
> sub common_function {
> }
>
>
> package myapp::somestuff;
> use strict;
> use warnings;
> use base 'myapp::Base';
>
# denied, home, login & logout are subs defined
# in Base.pm. get* are Ajax subs. Worked for me.
sub setup {
my $self = shift;
$self->start_mode('mode1');
$self->run_modes('mode1' => 'pageMain',
'mode2' => 'saveMain',
'denied' => 'denied',
'home' => 'home',
'login' => 'login',
'logout' => 'logout',
'getActivities' => 'getActivities',
'getActivity' => 'getActivity');
}
> my somestuff_function {
> my $self = shift;
> my $value = $self->common_function(); -----> error
> common_function not found
> }
>
> Shouldn't all of the base class functions be inherited?
>
> Ed Pigg
>
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]