[Bioperl-l] problem with Bio::SearchIO::Writer
cjfields at uiuc.edu
Wed Jan 10 11:35:17 EST 2007
> This example might be a little confusing because it uses an unusual
> (antiquated?) syntax.
> This would do the same thing:
> my $in = Bio::SearchIO->new(-format => 'blast',
> -file => shift @ARGV);
> The Bio::SearchIO documentation for the new() method
> describes all of the parameters it can take:
> > that is exactly i confusing with
> BioPerl can be hard to understand at first. Time spent
> reading bioperl.org and this mailing list is a good way to
> become familiar with the "Bioperl way" of doing things.
In general, it is recommended to use direct object syntax for constructors
as well as object methods, as it always works as expected:
$foo = Class::Foo->new();
Though indirect syntax almost always works, and is syntactically similar to
other programming languages:
$foo = new Class::Foo();
a number of very reliable sources (Programming Perl, Best Practices)
indicate there are subtle (but important) differences in the way these are
interpreted and compiled which can lead to hard-to-diagnose (and possibly
OS-dependent) bugs. Using direct syntax prevents this from occurring.
We have run into this very issue in Bioperl, in Bio::Root::Root::throw().
The problem persisted for a number of years, effectively preventing
bioperl-db from working properly in Windows after a normal installation,
even though the problem didn't appear on other OS's. Sendu managed to work
it out before the last release.
More information about the Bioperl-l