Mark Stosberg wrote:
[Dispatch] ERROR' for request '/': Unable to load module 'WebApp::Controller::Foo': Bad name after :: at WebApp/Controller/Base.pm line 98.
[..]

You need quotes around the package name. With them 'WebApp::DB::' is
like a constant...and you just can't concatenate variables like this.
This little script demonstates the bug and the fix:

package Foo::Zoo;
sub new { print "you found me!\n"; }

package main;
use strict;

my $a = 'Zoo';

# Uncomment either one for testing. Foo::$a->new;
# "Foo::$a"->new;


Yes, thanks Mark. Strangely enough I did something similar myself with a demo script and switched diagnostics on (something I had forgotten existed), and found the explanation about the quotation marks. But your demo app was much more elegant than mine :)

#####  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/                 ##
##                                                            ##
################################################################

Reply via email to