use SubOpt;
&odyssey ($gb, -option=>"neat!", -file=>"fancy.txt", "oops");
sub odyssey{
opt_default(option => 'none', file => 'hoge.txt');
# Set default values. This is optional.
my @args = opt_get(@_);
# Parse options.
my $gb = opt_as_gb(shift @args);
# Get the input value as a G instance
my $last = shift @args;
print $gb->{SEQ} , "\n";
print "last: $last\n";
print "option: ", opt_val("option"), "\n";
print "file: ", opt_val("file"), "\n";
# Option values are accessed via opt_val().
}
Description
SubOpt parses the arguments given to a subroutine in a similar
manner as GetOpt module.
Options are specified in the form: -option=>"hoge"
The above will input the value "hoge" with a key "option".
i.e. option with '-' is stored with the value pointed with '=>'.
supported methods:
opt_default(
if($#_ >= 1){
&msg_error("Error 1 in SubOpt::opt_as_gb():\n Given value is not a valid sequence.\n");
return'';
}elsif(length$_[0] < 1){return lastInstance G::IO();
}my$unknown = shift@_;
my$ref =\$ unknown;
my$ref2 = ref$unknown;
my$new_gb = newG::IO('blessed');
if($ref2 =~ /Bio::Seq/){returnnewG::IO($unknown, "bioperl", "no msg");
}elsif("$unknown" =~ /\=/){if(defined$unknown->{SEQ}){return$unknown;
}else{
&msg_error("Error 3 in SubOpt::opt_as_gb():\n Given value is not a valid sequence.\n");
return'';
}}elsif(ref$unknowneq'SCALAR'){$new_gb->{SEQ} = $$unknown;
return$new_gb;
}elsif(ref$unknowneq'REF'){$new_gb->{SEQ} = $$unknown;
return$new_gb;
}elsif(ref$refeq'SCALAR'){$new_gb->{SEQ} = $unknown;
return$new_gb;
}else{
&msg_error("Error 4 in SubOpt::opt_as_gb():\n Given value is not a valid sequence.\n");
return'';
}