i keep getting errors on this ... so i guess it's time to ask for more help. here's the boiled-down classes:
package Handler;
use strict;
use CGI;
sub new {
my $self = shift;
return bless { _cgi => CGI->new() }, $self;
}
sub cgi {
my $self = shift;
my $caller = caller();
return ( $caller eq 'Handler' ? $self->{_cgi} : $self->SUPER::->{_c
+gi} );
}
package HandlerMethods;
use strict;
use base qw/ Handler /;
sub doSomething {
my $self = shift;
my $page = $self->cgi->param('foo');
return 1;
}
now, problem is, i can't get the superclass *data*. in the subcalss,
$self->cgi is always undef, and i know that's because the subclass is calling the superclass *method* but not finding the CGI object in itself ( because it's superclass data ). i've tried
caller to make sure the calling package isn't the superclass ( obviously ).
i know the syntax *should* be easy, but i'm missing it.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.