[Bioperl-l] Re: Bio::Species validation broken
Hilmar Lapp
hlapp@gnf.org
Fri, 30 Aug 2002 14:32:18 -0700
Fixed and committed. Along the way I replaced t/data/revcomp_mrna.gb
with a current ensembl download (and truncated after 50 kb). The
previous version raised an error with the functional validation in
place due one trailing whitespace at the end of line. Now all tests
pass except RestrictionEnzyme.t.
-hilmar
On Friday, August 30, 2002, at 12:42 PM, Hilmar Lapp wrote:
> I just came across this by chance as the test case in bioperl-db
> gave wrong results for binomial, the reason being that the order of
> @classification on instantiation was reversed, which should have
> been caught by $species->validate_[species_]name() but wasn't. It
> turns out these validations are completely broken.
>
> First off,
>
> return $string =~ /yourregexp here/ or $self->throw("oops");
>
> will always return and never throw the exception. (Why? Doesn't
> look intuitively so, but it is true at least on Perl 5.6.0, Mac OS
> X). Safe, and more readable is
>
> return 1 if $string =~ /yourregexp here/;
> $self->throw("oops");
>
> Second, can anyone explain why the validating regexp for species
> name was set to be
>
> /^[\S\d\.]+$||""/
>
> This regexp is not only redundant in itself, it also matches every
> possible string.
>
> I'm going to fix this now, expect exceptions to be thrown finally ...
>
> -hilmar
> --
> -------------------------------------------------------------
> Hilmar Lapp email: lapp at gnf.org
> GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
> -------------------------------------------------------------
>
>
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------