| 1 | package App::PYX::Optimization; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Getopt::Std; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use PYX::Optimization; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | our $VERSION = 0.04; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | # Constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | my ($class, @params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # Create object. | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | # Object. | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | # Run script. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 5 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # Process arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | $self->{'_opts'} = { | |||||||||||||||||||||||||||||||||||||||||
| 28 | 'h' => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | if (! getopts('h', $self->{'_opts'}) || $self->{'_opts'}->{'h'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not &getopts("h", $self->{"_opts"}) or $self->{"_opts"}{"h"} or @ARGV < 1
not &getopts("h", $self->{"_opts"}) or $self->{"_opts"}{"h"}
MC/DC100%3/3
not &getopts("h", $self->{"_opts"}) or $self->{"_opts"}{"h"} or @ARGV < 1
not &getopts("h", $self->{"_opts"})
$self->{"_opts"}{"h"}
@ARGV < 1
Truth table100%4/4
not(A) or B or C
A= not &getopts("h", $self->{"_opts"})B= $self->{"_opts"}{"h"}C= @ARGV < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | || @ARGV < 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | print STDERR "Usage: $0 [-h] [--version] [filename] [-]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | print STDERR "\t-h\t\tPrint help.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | print STDERR "\t--version\tPrint version.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | print STDERR "\tfilename\tProcess on filename.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | print STDERR "\t-\t\tProcess on stdin.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | $self->{'_filename_or_stdin'} = $ARGV[0]; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | # PYX::Optimization object. | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | my $optimizer = PYX::Optimization->new; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | # Parse from stdin. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | if ($self->{'_filename_or_stdin'} eq '-') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | $optimizer->parse_handler(\*STDIN); | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | # Parse file. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | $optimizer->parse_file($self->{'_filename_or_stdin'}); | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||||||||||||||||||||||||