[Bioperl-l] Detecting type of an object.

Peter van Heusden pvh@egenetics.com
Thu, 12 Oct 2000 17:43:03 +0200 (SAST)

On Thu, 12 Oct 2000 hilmar.lapp@pharma.novartis.com wrote:

> I'm not sure why you want to test the object type in this case. Anyway, you
> can ask
>    $class_name = ref($obj);
>    # branch depending on the value of class_name

->isa (after a ref() test, of course) is safer than branching on
$class_name, since it deals with inheritance (i.e. what if you're actually
getting a Bio::MySeq back, which isa Bio::Seq, from the method).

Peter van Heusden				pvh@egenetics.com
Electric Genetics