# ---- Adding the mandatory arguments to the arg_list ----
push @{ $arg_list }, (
-
{ long => 'help', short => '?', type => 'flag', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
{ long => 'stream_in', short => 'I', type => 'file!', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
{ long => 'stream_out', short => 'O', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
# Returns nothing.
- my ( $script, $wiki );
+ my ( %options, $help, $script, $wiki );
+
+ %options = %{ $options };
+ $help = $options{ 'help' };
+ delete $options{ 'help' };
$script = Maasha::Common::get_scriptname();
if ( $script ne 'print_wiki' )
{
- if ( exists $options->{ 'help' } or -t STDIN )
+ if ( $help or -t STDIN )
{
- if ( not ( exists $options->{ 'stream_in' } or $options->{ 'data_in' } ) )
+ if ( not ( exists $options{ 'stream_in' } or $options{ 'data_in' } ) )
{
- if ( scalar keys %{ $options } <= 1 )
+ if ( scalar keys %options == 0 )
{
$wiki = $ENV{ 'BP_DIR' } . "/bp_usage/$script.wiki";
- if ( exists $options->{ 'help' } ) {
+ if ( $help ) {
`print_wiki --data_in=$wiki --help`;
- } elsif ( $script =~ /^(list_biopieces|list_genomes|biostat)$/ ) {
+ } elsif ( $script =~ /^(list_biopieces|list_genomes|list_mysql_databases|biostat)$/ ) {
return;
} else {
`print_wiki --data_in=$wiki`;
}
-sub getopt_files
-{
- # Martin A. Hansen, November 2007.
-
- # Extracts files from an explicit GetOpt::Long argument
- # allowing for the use of glob. E.g.
- # --data_in=test.fna
- # --data_in=test.fna,test2.fna
- # --data_in=*.fna
- # --data_in=test.fna,/dir/*.fna
-
- my ( $option, # option from GetOpt::Long
- ) = @_;
-
- # Returns a list.
-
- my ( $elem, @files );
-
- foreach $elem ( split ",", $option )
- {
- if ( -f $elem ) {
- push @files, $elem;
- } elsif ( $elem =~ /\*/ ) {
- push @files, glob( $elem );
- }
- }
-
- return wantarray ? @files : \@files;
-}
+# marked for deletion - obsolete?
+#sub getopt_files
+#{
+# # Martin A. Hansen, November 2007.
+#
+# # Extracts files from an explicit GetOpt::Long argument
+# # allowing for the use of glob. E.g.
+# # --data_in=test.fna
+# # --data_in=test.fna,test2.fna
+# # --data_in=*.fna
+# # --data_in=test.fna,/dir/*.fna
+#
+# my ( $option, # option from GetOpt::Long
+# ) = @_;
+#
+# # Returns a list.
+#
+# my ( $elem, @files );
+#
+# foreach $elem ( split ",", $option )
+# {
+# if ( -f $elem ) {
+# push @files, $elem;
+# } elsif ( $elem =~ /\*/ ) {
+# push @files, glob( $elem );
+# }
+# }
+#
+# return wantarray ? @files : \@files;
+#}
sub sig_handler
}
+sub biopiecesrc
+{
+ # Martin A. Hansen, July 2009.
+
+ # Read Biopiece configuration info from .biopiecesrc.
+ # and returns the value of a given key.
+
+ my ( $key, # configuration key
+ ) = @_;
+
+ # Returns a string.
+
+ my ( $file, $fh, $record );
+
+ $file = "$ENV{ 'HOME' }/.biopiecesrc";
+
+ return undef if not -f $file;
+
+ $fh = Maasha::Filesys::file_read_open( $file );
+ $record = get_record( $fh );
+ close $fh;
+
+ if ( exists $record->{ $key } ) {
+ return $record->{ $key };
+ } else {
+ return undef;
+ }
+}
+
+
END
{
clean_tmp();