Can't call NEXT::f from B::g
$ perl test.pl
Can't call NEXT::f from B::g at /home/porton/t/test2.pl line 10
Why the error?
#!/usr/bin/perl -w
use NEXT;
package A;
sub f { print "123\n" }
package B;
use base 'A';
sub g { shift->NEXT::f }
B->g;
Re: Can't call NEXT::f from B::g
Victor Porton <porton [at] narod.ru> writes:
> $ perl test.pl
> Can't call NEXT::f from B::g at /home/porton/t/test2.pl line 10
>
> Why the error?
Doesn't the following except from the documentation to NEXT explains
it?
Note that it is a fatal error for any method (including "AUTOLOAD") to
attempt to redispatch any method that does not have the same name. For
example:
sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() }
//Makholm
Re: Can't call NEXT::f from B::g
On 30 Jan, 16:47, Peter Makholm <pe... [at] makholm.net> wrote:
> Victor Porton <por... [at] narod.ru> writes:
> > $ perl test.pl
> > Can't call NEXT::f from B::g at /home/porton/t/test2.pl line 10
>
> > Why the error?
>
> Doesn't the following except from the documentation to NEXT explains
> it?
>
> Note that it is a fatal error for any method (including "AUTOLOAD") to
> attempt to redispatch any method that does not have the same name. For
> example:
>
> sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() }
Yes, that was my error.
New question: Why the below script does not print "123"?
#!/usr/bin/perl -w
use NEXT;
package A;
sub f { print "123\n" }
package B;
use base 'A';
package C;
use base 'B';
sub f { shift->NEXT::f }
C->f;
Re: Can't call NEXT::f from B::g
On Wed, 30 Jan 2008 07:51:26 -0800 (PST), Victor Porton
<porton [at] narod.ru> wrote:
>package A;
>sub f { print "123\n" }
>
>package B;
>use base 'A';
Incidentally, base.pm does more than you expect. You may want to just
set [at] ISA manually in this case.
Moreover, base.pm is regarded as buggy by some.
Moreover, do not try to use B as a generic namespace, since it
actually exists. In fact when I stumbled upon your subject, I thought
it had to do with Perl's opcodes...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,