Can"t call NEXT::f from B::g

Can"t call NEXT::f from B::g

am 30.01.2008 15:40:54 von Victor Porton

$ 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

am 30.01.2008 15:47:11 von Peter Makholm

Victor Porton 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

am 30.01.2008 16:51:26 von Victor Porton

On 30 Jan, 16:47, Peter Makholm wrote:
> Victor Porton 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

am 30.01.2008 17:56:30 von Michele Dondi

On Wed, 30 Jan 2008 07:51:26 -0800 (PST), Victor Porton
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 @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^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,