[Bioperl-l] Annotated.pm

Hilmar Lapp hlapp at gmx.net
Sat Nov 27 03:41:39 EST 2004


I should add that even Annotated::source() is documented as returning a 
single object:

  Returns : a Bio::Annotation::SimpleValue object representing the 
source.

In this it is easier to detect the problem because a number is not a 
reference, so the first attempt to de-reference it will cause a script 
to die. (Although I wouldn't want to be the person having to debug the 
original cause ...)

See my point?

	-hilmar

On Saturday, November 27, 2004, at 12:32  AM, Hilmar Lapp wrote:

>
> But this is not what I meant. As an example, $annotated->source_tag() 
> will delegate to source():
>
> sub source_tag {
>   return $shift->source(@_);
> }
>
> Annotated::source returns what the get_Annotations() short-cut returns:
>
>   return $self->get_Annotations('source');
>
> If somebody accidentally added another annotation with tag 'source', 
> not knowing that it is being used internally, the next call to 
> $annotated->source_tag() will return a number, not the source tag, and 
> not an array of source tags.
>
> This is what I mean by brittle. I mean that it is easy to hang 
> yourself as a user and you don't even get a warning before you die. In 
> this case it will even be a very slow death since a number is still a 
> scalar, and in order to realize the problem you need to actually see 
> that it is a number and not a meaningful string.
>
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------




More information about the Bioperl-l mailing list