[Bioperl-l] Simplifications now possible with Perl 5.6.1 requirement?

Sendu Bala bix at sendu.me.uk
Tue Sep 26 05:14:02 EDT 2006


Torsten Seemann wrote:
> Now that we are confirmed that Perl 5.6.1 is a minimum requirement The
> bioperl-live code base could be simplified somewhat. Below are some 
> major examples. Any thoughts, comments, additions ?
> 
> -----
> our $x; # or my $x (where appropriate)
> # instead of
> use vars ($x); BEGIN { $x=... };
> 
> -----
> use base qw(Bio::Class);
> # instead of
> use vars qw(@ISA); @ISA=qw(Bio::Class);

use base arrived in 5.4? Anyway, some modules already use it, and I 
agree we all should. Worth just converting all modules over?


> use Test;
> BEGIN { plan tests => 42 }
> # instead of
> use lib './';
> BEGIN {
>      eval { require Test; };
>      if ( $@ ) { use lib 't'; }
>      use Test;
>      plan tests => 42;
> }

We want to move to Test::More. When did More become a core module?


> open my $FH, '>', $infile
> # instead of
> open FH, ">$infile";

The latter form has caused at least one bug, so this is worth taking 
note of.


> Please contribute to http://www.bioperl.org/wiki/Bioperl_Best_Practices

I've added:
Avoid regexps where possible: string eq > index() > =~

Of course, most people happily abuse =~ for just about everything, 
including myself ;)


More information about the Bioperl-l mailing list