Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; package BAR; sub bang { print "BANG!\n"; } package FOO; use base qw( BAR ); sub new { my $class = shift; return bless {}, $class; } sub bang { print "* please be quiet *\n" } package BAZ; use base qw( BAR ); sub bang { my $self = shift; $self->SUPER::bang(); } sub new { my $class = shift; return bless {}, $class; } package main; my $foo1 = FOO->new(); my $foo2 = BAZ->new(); my $foo3 = FOO->new(); $foo1->bang(); $foo2->bang(); $foo3->SUPER::bang();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why can't I call SUPER from user code?
by hv (Prior) on Mar 31, 2006 at 00:06 UTC | |
|
Re: Why can't I call SUPER from user code?
by eric256 (Parson) on Mar 30, 2006 at 23:34 UTC | |
by Anonymous Monk on Mar 30, 2006 at 23:41 UTC | |
by eric256 (Parson) on Mar 31, 2006 at 01:44 UTC | |
|
Re: Why can't I call SUPER from user code?
by ysth (Canon) on Mar 31, 2006 at 02:49 UTC | |
|
Re: Why can't I call SUPER from user code?
by samtregar (Abbot) on Mar 30, 2006 at 23:36 UTC |