The following question concerning NEXT.pm was posed on comp.lang.perl.modules on Jan 13 2005 by J Krugman. I was able to confirm the problem but unable to diagnose the illness. SuperSearch suggests the problem has not previouly been discussed in the monastery. Since the posting hasn't attracted any other responses, I figured it would be a good idea to consult the monks.

J Krugman: Before I go off an file a bug report, I want to make sure that I got things right. In the SYNOPSIS section for Damian Conway's NEXT module's POD, there's the following extended example:

use NEXT; package A; sub A::method { print "$_[0]: A method\n"; $_[0]->NEXT::method() } sub A::DESTROY { print "$_[0]: A dtor\n"; $_[0]->NEXT::DESTROY() } package B; use base qw( A ); sub B::AUTOLOAD { print "$_[0]: B AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub B::DESTROY { print "$_[0]: B dtor\n"; $_[0]->NEXT::DESTROY() } package C; sub C::method { print "$_[0]: C method\n"; $_[0]->NEXT::method() } sub C::AUTOLOAD { print "$_[0]: C AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub C::DESTROY { print "$_[0]: C dtor\n"; $_[0]->NEXT::DESTROY() } package D; use base qw( B C ); sub D::method { print "$_[0]: D method\n"; $_[0]->NEXT::method() } sub D::AUTOLOAD { print "$_[0]: D AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub D::DESTROY { print "$_[0]: D dtor\n"; $_[0]->NEXT::DESTROY() } package main; my $obj = bless {}, "D"; $obj->method(); # Calls D::method, A::method, C::method $obj->missing_method(); # Calls D::AUTOLOAD, B::AUTOLOAD, C::AUTOLO +AD # Clean-up calls D::DESTROY, B::DESTROY, A::DESTROY, C::DESTROY

Contrary to what the comments above say, when I run this example, the output that I get is:

D=HASH(0x8118164): D method D=HASH(0x8118164): C method D=HASH(0x8118164): D AUTOLOAD D=HASH(0x8118164): B AUTOLOAD D=HASH(0x8118164): C AUTOLOAD D=HASH(0x8118164): D dtor D=HASH(0x8118164): B dtor D=HASH(0x8118164): C dtor

(snip additional question from original c.l.p.mod. posting)

What's the story? Is NEXT really as broken as it looks, or am I missing something? My version of Perl is 5.8.4 and my version of NEXT is 0.60 (the latest one available from CPAN). (-- end J Krugman)

Any thoughts? Thanks.

Jim Keenan


In reply to Is Conway's NEXT.pm broken? by jkeenan1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.