|laziness, impatience, and hubris|
Re: CGI::Application Errorby chipmunk (Parson)
|on Nov 18, 2001 at 10:11 UTC||Need Help??|
The problem appears to be in your new method:
You are shifting the first argument into $self, and then calling methods on it as if it were an object. However, the point of new is to create an object. The first argument is the name of the class, which in this case is 'bluebox'.
A standard new method might look something like this:
This creates a hash with some initial values, blesses the hash as a member of $class, and returns the resulting object.
In your module, you're inheriting from CGI::Application; you probably want to let CGI::Application create the object.
I haven't tested this approach with CGI::Application. It depends on CGI::Application being properly written to support inheritance. That means that CGI::Application's new method, when it calls bless, must use whatever class name was passed in, rather than hard-coding 'CGI::Application'.
Update: P.S. If you don't need to do any extra initialization in the new method, you can simply inherit CGI::Application's new method, rather than defining your own.