[Bioperl-l] proposed patch to Bio/Annotation/SimpleValue.pm

Cook, Malcolm MEC at stowers-institute.org
Fri Jan 19 20:39:24 UTC 2007


I got an error upon incrementing the score of a
Bio::SeqFeature::Annotated 

Operation "+": no method found,
	left argument in overloaded package
Bio::Annotation::SimpleValue,
	right argument has no overloaded magic at ./myscript line xxxx.

It turns out that Bio/Annotation/SimpleValue overloaded "" and eq but
did not provide a fallback for other operators.

The following patch should fix that.

Any Objections?

Malcolm Cook
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, Missouri
 


Index: SimpleValue.pm
===================================================================
RCS file:
/home/repository/bioperl/bioperl-live/Bio/Annotation/SimpleValue.pm,v
retrieving revision 1.21
diff -c -r1.21 SimpleValue.pm
*** SimpleValue.pm	26 Sep 2006 22:03:05 -0000	1.21
--- SimpleValue.pm	19 Jan 2007 20:34:45 -0000
***************
*** 62,69 ****
  
  package Bio::Annotation::SimpleValue;
  use strict;
! use overload '""' => sub { $_[0]->value};
! use overload 'eq' => sub { "$_[0]" eq "$_[1]" };
  
  # Object preamble - inherits from Bio::Root::Root
  
--- 62,72 ----
  
  package Bio::Annotation::SimpleValue;
  use strict;
! 
! use overload
!   '""' => sub { $_[0]->value},
!   'eq' => sub { "$_[0]" eq "$_[1]" },
!   fallback => 1;
  
  # Object preamble - inherits from Bio::Root::Root
  




More information about the Bioperl-l mailing list