[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Starmapping now in module form



As you may recall, the starmapping code was getting a bit verbose (at 
14K).  I've modularized the lot of it!  What's amazing is that this is my 
first attempt at writting a module from scratch, and it WORKS! That big 
script can now be written:

#!perl -w

use strict;
use Starmap::Gliese;

use vars qw($my_version $my_package);

$my_package = $Starmap::Gliese::PACKAGE;
$my_version = $Starmap::Gliese::VERSION;

print "$my_package, version $my_version\n";

init_settings();
usr_console();
run_catalog();

print "All Done!\n";

__END__

$PACKAGE and $VERSION are @EXPORT_OK

The subroutines called above are the only ones exported, and %settings is 
also exported.

By optimizing the routine that printed the current position in the file 
to STDOUT so that it only gets called when that position matches the user 
constraints (and thus is written to the log), the code runs much faster 
now.  I was uselessly printing to the screen, when the program was 
actually doing nothing else at all.  The upshot of having %settings 
available is that you can bypass the usr_console(); subroutine, and write 
your own interface!  At the moment you must call init_settings(); to set 
the defaults, but I'll probably change that so that the defaults are set 
internally and then not export init_settings();

If enough people are interested, I'll post it to the MacPerl Pages.

--B

# Fungal Parataxonomy                   Mycology Information (Mycoinfo)
# Webmaster, Staff Writer      **The World's First Mycology E-Journal**   
# <mailto:webmaster@mycoinfo.com>            <http://www.mycoinfo.com/> 
#
# First they ignore you. Then they laugh at you. Then they fight you.
# Then you win.                                     --Mohandas Gandhi


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org