spork has asked for the wisdom of the Perl Monks concerning the following question:
package Foo; use base 'CGI::Application'; use Bar; @ISA = ("bar"); sub cgiapp_init { my $foo = new_foo(); print "foo = $foo\n"; } sub setup { my $self = shift; $self->start_mode('mode1'); $self->run_modes( 'mode1' => 'sub1', 'mode2' => 'sub2', 'mode3' => 'sub3' ); $self->tmpl_path('/applicant'); } sub new_foo { my $class=shift; $class=ref($class)|| $class; my $foo = { stuff => '', morestuff => '', super => Bar->new() }; bless ($foo, $class); } sub sub1 { print "Show some stuff\n"; } 1;
When run as is from the command line there is an error:
"Can't locate object \"new\" via package Foo..."
When @ISA is commented out the results are the value of the $foo object (as instructed in ciapp_init()) and a bit of HTML as expected.
I have looked through the Monk archives and googled myself silly. Can someone point me in the right direction please?
Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Application and object inheritance
by cfreak (Chaplain) on Jul 27, 2005 at 14:39 UTC | |
by spork (Monk) on Jul 27, 2005 at 15:45 UTC | |
by cfreak (Chaplain) on Jul 28, 2005 at 03:55 UTC | |
|
Re: CGI::Application and object inheritance
by ikegami (Patriarch) on Jul 27, 2005 at 15:05 UTC | |
by spork (Monk) on Jul 27, 2005 at 15:39 UTC | |
by donarb (Beadle) on Jul 27, 2005 at 15:56 UTC | |
by cees (Curate) on Jul 27, 2005 at 16:56 UTC | |
|
Re: CGI::Application and object inheritance
by sacked (Hermit) on Jul 27, 2005 at 14:30 UTC | |
by ikegami (Patriarch) on Jul 27, 2005 at 14:58 UTC |