File Coverage

blib/lib/App/PYX/Optimization.pm
Criterion Covered Total %
statement 15 30 50.0
branch 0 4 0.0
condition 0 6 0.0
subroutine 5 6 83.3
pod 2 2 100.0
total 22 48 45.8


line stmt bran cond sub pod time code
1             package App::PYX::Optimization;
2              
3 3     3   74702 use strict;
  3         19  
  3         88  
4 3     3   16 use warnings;
  3         6  
  3         73  
5              
6 3     3   6181 use Getopt::Std;
  3         166  
  3         234  
7             use PYX::Optimization
8              
9 3     3   1380 our $VERSION = 0.01;
  3         155264  
  3         768  
10              
11             # Constructor.
12             sub new {
13 1     1 1 87 my ($class, @params) = @_;
14              
15             # Create object.
16 1         3 my $self = bless {}, $class;
17              
18             # Object.
19 1         4 return $self;
20             }
21              
22             # Run script.
23             sub run {
24 0     0 1   my $self = shift;
25              
26             # Process arguments.
27 0           $self->{'_opts'} = {
28             'h' => 0,
29             };
30 0 0 0       if (! getopts('h', $self->{'_opts'}) || $self->{'_opts'}->{'h'}
      0        
31             || @ARGV < 1) {
32              
33 0           print STDERR "Usage: $0 [-h] [--version] [filename] [-]\n";
34 0           print STDERR "\t-h\t\tPrint help.\n";
35 0           print STDERR "\t--version\tPrint version.\n";
36 0           print STDERR "\tfilename\tProcess on filename\n";
37 0           print STDERR "\t-\t\tProcess on stdin\n";
38 0           return 1;
39             }
40 0           $self->{'_filename_or_stdin'} = $ARGV[0];
41              
42             # PYX::Optimization object.
43 0           my $optimizer = PYX::Optimization->new;
44              
45             # Parse from stdin.
46 0 0         if ($self->{'_filename_or_stdin'} eq '-') {
47 0           $optimizer->parse_handler(\*STDIN);
48              
49             # Parse file.
50             } else {
51 0           $optimizer->parse_file($self->{'_filename_or_stdin'});
52             }
53              
54 0           return 1;
55             }
56              
57             1;
58              
59             __END__