[Bioperl-l] problem with Bio::SearchIO::Writer
Chris Fields
cjfields at uiuc.edu
Wed Jan 10 16:35:17 UTC 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:
>
> http://doc.bioperl.org/bioperl-live/Bio/SearchIO.html#POD1
>
>
> > 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.
>
>
> Dave
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();
$foo->bar();
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.
chris
More information about the Bioperl-l
mailing list