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

Re^2: isa() on any scalar

by rvosa (Curate)
on Jun 11, 2005 at 20:41 UTC ( #465843=note: print w/replies, xml ) Need Help??

in reply to Re: isa() on any scalar
in thread isa() on any scalar

Two things: i) are you building an OO module for phylogenetics? (If yes, let's join forces); ii) here's how I did it:
sub parent { my $self = $_[0]; if ( $_[1] ) { my $parent = $_[1]; if ( $parent->can('parent') ) { $self->[PARENT] = $parent; } else { my $ref = ref $self; carp "parents can only be $ref objects"; return; } } return $self->[PARENT]; }
This follows the "if it walks like a duck" paradigm. Not saying that this is the best way to do it, but it works for me.

Replies are listed 'Best First'.
Re^3: isa() on any scalar
by mrborisguy (Hermit) on Jun 11, 2005 at 21:05 UTC

    Phylogeny: (n.)
    1. The evolutionary development and history of a species or higher taxonomic grouping of organisms. Also called phylogenesis.
    2. The evolutionary development of an organ or other part of an organism: the phylogeny of the amphibian intestinal tract.
    3. The historical development of a tribe or racial group.

    Okay, just looked it up... nope, that's not what I'm doing at all. Sorry! Thanks for the piece of code though!


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://465843]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-07-20 17:09 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (438 votes). Check out past polls.