in reply to Skipping the middle man & the SUPER gotcha
The "::" makes it look like a procedural interface call, but it is a bona fide OO method call, with an implicit instance (or package name) as first argument and all; a rather different animal from the similar-looking (and wrong) Grandpa::hello().
I think that:
$me->Grandpa::hello()
is the same as:
Grandpa::hello($me);
which isn't OO. You can test it like so:
use strict; package other; sub hello { print "otherwise @{[ref shift]}\n"; } package Grandpa; sub hello { my $class = ref $_[0] || $_[0]; print "How do you do, from $class.\n"; } package Dad; our @ISA = 'Grandpa'; sub hello { my $class = ref $_[0] || $_[0]; print "Hiya from $class!\n"; } package Me; our @ISA = 'Dad'; sub new { bless {} } sub hello { print "hello\n"; } package main; my $me = bless {}, 'Me'; # look Ma, no constructor! $me->Grandpa::hello; $me->other::hello; __END__ How do you do, from Me. otherwise Me
hth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Skipping the middle man & the SUPER gotcha
by merlyn (Sage) on Apr 02, 2005 at 17:05 UTC | |
by Thelonious (Scribe) on Apr 02, 2005 at 19:40 UTC | |
by TimToady (Parson) on Apr 02, 2005 at 20:00 UTC | |
by Thelonious (Scribe) on Apr 03, 2005 at 11:52 UTC |