Hi Clint,
Correct me if I'm wrong, but I believe $self is already passed to the
sub.
package MyApp;
use base 'CGI::Application';
use strict;
use warnings;
sub setup {
my $self = shift;
$self->run_modes( mode1 => 'Module1::mode1' );
}
package Module1;
sub mode1 {
ref $_[0];
}
1;
prints:
C:\cgiapp>perl i.pl rm=mode1
Content-Type: text/html; charset=ISO-8859-1
MyApp
HTH,
-Brian
> -----Original Message-----
> From: Clint Moore [mailto:suppressed
> Sent: Thursday, October 30, 2003 10:59 AM
> To: suppressed
> Subject: [cgiapp] Calling external modules?
>
>
> I swear that it is probably something that I am doing but I
can't
> for
> the life of me figure out where I'm going wrong. I have some
run_modes
> defined in a separate file and referenced like this:
>
> sub setup {
> my $self = shift;
> $self->run_modes(
> 'mode1' => 'Module::method(\$self)',
> 'mode2' => 'Module::method2(\$self)',
> );
> }
>
> In 5.6.0 this worked no problem. Now that I have upgraded to
5.8.x,
> I
> cannot get this to work for anything.
>
> Now the modules 'use' just fine. But I get ye olde "cannot
locate
> object method "method(\$self)" in package "Module" error when I
> actually try to use that run mode in the program. I'm, of course,
> 'use'ing the Module in the CGI::App subclass package.
>
> The curious thing is that, in setup... i've not tried it
elsewhere,
> I
> can call new and run the methods off of the module no problem. I
> cannot find any reference to possible changes in how 'use' is handled
> in 5.8.x that might be relevant to this but maybe I'm looking in the
> wrong places or something.
>
> Can someone tell me what I'm doing wrong? I can post more
complete
> code if required.
>
> -cm
>
>
> ---------------------------------------------------------------------
> Web Archive: http://www.mail-archive.com/suppressed/
> http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
http://www.gordano.com - Messaging for educators.
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.