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.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]; }
In reply to Re^2: isa() on any scalar
by rvosa
in thread isa() on any scalar
by mrborisguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |