in reply to Re: How can I find the calling object?
in thread How can I find the calling object?
This prints:#!/usr/bin/perl package Caller; sub new { bless {}, 'Caller' } sub call { my( $self, $one ) = @_; $one->output; } sub output { "I am the Caller\n" } 1; package Called; use PadWalker 'peek_my'; sub new { bless {}, 'Called' } sub output { my $caller = peek_my( 1 )->{ '$self' }; #$h->{ '$self' }; print STDOUT $$caller->output(); } 1; package main; my $one = new Caller; my $two = new Called; $one->call( $two );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How can I find the calling object?
by Aristotle (Chancellor) on Nov 18, 2002 at 17:59 UTC | |
by strider corinth (Friar) on Nov 18, 2002 at 18:09 UTC | |
by Aristotle (Chancellor) on Nov 18, 2002 at 18:30 UTC | |
by John M. Dlugosz (Monsignor) on Nov 18, 2002 at 19:15 UTC | |
by strider corinth (Friar) on Nov 18, 2002 at 19:26 UTC | |
by John M. Dlugosz (Monsignor) on Nov 18, 2002 at 20:42 UTC | |
|