Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

ehdonhon's scratchpad

by ehdonhon (Curate)
on Jun 04, 2004 at 17:59 UTC ( #361020=scratchpad: print w/replies, xml ) Need Help??

Here is some (very slightly modified) code directly from the NEXT module perldoc. Note I commented out sub foo in package E:

package A; sub foo { print "called A::foo\n"; shift->NEXT::UNSEEN::foo() } package B; sub foo { print "called B::foo\n"; shift->NEXT::UNSEEN::foo() } package C; use vars qw( @ISA ); @ISA = qw( A ); sub foo { print "called C::foo\n"; shift->NEXT::UNSEEN::foo() } package D; use vars qw( @ISA ); @ISA = qw(A B); sub foo { print "called D::foo\n"; shift->NEXT::UNSEEN::foo() } package E; use vars qw( @ISA ); @ISA = qw(C D); #sub foo { print "called E::foo\n"; shift->NEXT::UNSEEN::foo() } package ::; E->foo();

And here is its output:

called C::foo
called A::foo
called D::foo
called B::foo

Now, here is my code that does almost the exact same thing:

#!/usr/local/bin/perl use NEXT; use strict; package ROOT; sub traverse { print __PACKAGE__, "\n"; } package LEFT_CHILD; #use base 'ROOT'; use vars qw( @ISA ); @ISA = qw( ROOT ); sub traverse { my $package = shift; print __PACKAGE__, "\n"; $package->NEXT::UNSEEN::traverse(); } package RIGHT_CHILD; #use base 'ROOT'; use vars qw( @ISA ); @ISA = qw( ROOT ); sub traverse { my $package = shift; print __PACKAGE__, "\n"; $package->NEXT::UNSEEN::traverse(); } package GRANDCHILD; #use base 'LEFT_CHILD'; #use base 'RIGHT_CHILD'; use vars qw( @ISA ); @ISA = qw( LEFT_CHILD RIGHT_CHILD ); package ::; GRANDCHILD->traverse();

Here is the output:

<demerphq> Incidentally to those who say XP means nothing: The abscence of XP doesnt mean you arent a good programmer, but the prescence of it doessuggest hat you arent a crap programmer. my $0.02. :-)

Nodes relating to XP:

(humor) The first rule of The XP club is...
One Point to Saint hood
The meaning of life, the universe and node reputation
Experience this!
Experience for nodes (to display or not)
Too much positive votes on questions (Seekers of Perl Wisdom)
PM's XP system, fair or not?
Why your product is sold?
XP for CB
When to --
Sainthood via Seniority Simulation
Re: Re: Re: reading lines
Reputation for anonymous monks
Voting - single Vs. multiple nodes
I am "Big XP Baby" button
Voting etiquette
Possible changes to Voting/XP
Why down vote is soo easy?!
If (the PM XP system) ain't broke, don't fix it
Encouraging comments for downvotes
Experience points counter issue?
Fastest Rising Monks - Revisited
Huge ammounts of incoming EXP
Distribution of Levels and Writeups
No more XP for voting!
Node Rep - A newbies viewpoint
(contest) Help analyze PM reputation statistics
XP, page ranking, sponsored links and the fortune of PM
XP, page ranking, sponsored links and the fortune of PM
Why upvote a node?
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-01-27 06:26 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (70 votes). Check out past polls.