Bioperl: SeqIO drivers

hilmar.lapp@pharma.Novartis.com hilmar.lapp@pharma.Novartis.com
Wed, 10 May 2000 15:45:09 +0100




> There is now code which initializes SeqIO such that the existing formats are
> already "registered". I'm not so familiar with perl guts, but I think there's
> something like a BEGIN section in a module that is executed upon
> use a_module;
> anywhere. So, by this section one could even have modules registering
> themselves once you include them as a use statement.

Be careful about this. BEGIN blocks are executed emediately after the perl
parser
processes them, so they are executed once and only once when the package is
loaded
for the first time. This is probably the behaviour that you want. I think that
the
package method IMPORT (but check the name in the panther book) is executed
whenever a package is 'use'd by another. So - probably what you want is a BEGIN
block in SeqIO that registers each well-known driver, rather than having a BEGIN
or IMPORT block in each driver.
<snip/>

     <reply from=hilmar>
     Not really. I thought of it more like e.g. JDBC drivers are loaded: you say

          Class.forName(myDriverClassName);

     which loads the driver class, and when it is first loaded it registers
     itself at the DriverManager. I don't see the necessity that a driver
     registers itself each time it
     is 'use'd. (It would have to check anyway whether or not there is already a
     driver for
     for that format registered.)
     <greeting>
     Cheers, :-)

          Hilmar
     </greeting>
     </reply>





=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================