tap tap tap
comes the sound from a cubicle

is it a guinea pig?
no

is it a coder?
yes

is he a guinea pig?
yes

Replies are listed 'Best First'.
(jeffa) Re: guinea pigs in zen
by jeffa (Bishop) on Mar 26, 2002 at 17:37 UTC
    my $cube = new Cubicle; $cube->add(new Coder); my $thing = $cube->query; print "\L $thing->{sound} comes the sound from a @{[ref($cube)]}. is it a guinea pig? @{[ref($thing) eq 'Pig::guinea' ? 'yes' : 'no']} is it a coder? @{[ref($thing) eq 'Coder' ? 'yes' : 'no']} is the coder a guinea pig? @{[$thing->isa('Pig::guinea') ? 'yes' : 'no']} "; package Pig::guinea; sub new {bless{sound=>('ernk 'x3)},shift} package Coder; use base Pig::guinea; sub new {bless{sound=>('tap 'x3)},shift} package Cubicle; sub new {bless{contents=>[]},shift} sub add {push @{shift->{contents}},shift} sub query {pop @{shift->{contents}}}
A reply falls below the community's threshold of quality. You may see it by logging in.