Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Problem with header() method when extending CGI.pm

by Hrunting (Pilgrim)
on Jan 09, 2002 at 19:11 UTC ( [id://137457]=note: print w/replies, xml ) Need Help??


in reply to Problem with header() method when extending CGI.pm

Can I ask why you're doing all that work in the new() method? Why not just something like:
package IsaCGI; use strict; use CGI; use vars qw(@ISA); @ISA=qw(CGI); sub my_method{ return "hello from isa_cgi\n"; }
A CGI instance is blessed like:
sub new { my($class,$initializer) = @_; my $self = {}; bless $self,ref $class || $class || $DefaultClass; ...
which means that in your code, if you do:
my $q = new IsaCGI;
it will be blessed into the IsaCGI class. Is there a reason you're not doing it that way? Even in more complicated scenarios of inheritance, one gets the base object first, then tinkers with it. You seem to be doing it the other way around.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://137457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found