File Coverage

lib/Panotools/Script/Line/Option.pm
Criterion Covered Total %
statement 27 34 79.4
branch 1 4 25.0
condition 2 5 40.0
subroutine 7 8 87.5
pod 0 5 0.0
total 37 56 66.0


line stmt bran cond sub pod time code
1             package Panotools::Script::Line::Option;
2              
3 10     10   57 use strict;
  10         18  
  10         500  
4 10     10   55 use warnings;
  10         19  
  10         6586  
5              
6             =head1 NAME
7              
8             Panotools::Script::Line::Option - Hugin Options
9              
10             =head1 SYNOPSIS
11              
12             Option parameters are described by a line beginning with '#hugin_'
13              
14             =head1 DESCRIPTION
15              
16             =cut
17              
18             sub new
19             {
20 16     16 0 35 my $class = shift;
21 16   33     112 $class = ref $class || $class;
22 16         60 my $self = bless {}, $class;
23 16         291 $self->_defaults;
24 16         54 return $self;
25             }
26              
27             sub _defaults
28             {
29 16     16   38 my $self = shift;
30 16         50 %{$self} =
  16         362  
31             (optimizeReferenceImage => 0,
32             blender => 'enblend',
33             remapper => 'nona',
34             enblendOptions => '',
35             enfuseOptions => '',
36             hdrmergeOptions => '',
37             outputLDRBlended => 'true',
38             outputLDRLayers => 'false',
39             outputLDRExposureRemapped => 'false',
40             outputLDRExposureLayers => 'false',
41             outputLDRExposureBlended => 'false',
42             outputHDRBlended => 'false',
43             outputHDRLayers => 'false',
44             outputHDRStacks => 'false',
45             outputLayersCompression => 'PACKBITS',
46             outputImageType => 'tif',
47             outputImageTypeCompression => 'NONE',
48             outputJPEGQuality => 100,
49             outputImageTypeHDR => 'exr',
50             outputImageTypeHDRCompression => '');
51             }
52              
53             sub Identifier
54             {
55 142     142 0 239 my $self = shift;
56 142         826 return "#hugin_";
57             }
58              
59             sub Parse
60             {
61 5     5 0 19 my $self = shift;
62 5   50     34 my $string = shift || return 0;
63 5         46 my ($key, $value) = $string =~ /^#hugin_([[:alnum:]]+) *(.*)/g;
64 5         19 $self->{$key} = $value;
65 5         24 return 1;
66             }
67              
68             sub Assemble
69             {
70 7     7 0 18 my $self = shift;
71 7         17 my @items;
72 7         17 for my $entry (sort keys %{$self})
  7         113  
73             {
74 142         242 push @items, $self->Identifier . $entry .' '. $self->{$entry};
75             }
76 7 50       2162 return (join "\n", @items) ."\n" if (@items);
77 0           return '';
78             }
79              
80             sub Report
81             {
82 0     0 0   my $self = shift;
83 0           my @report;
84 0           for my $entry (sort keys %{$self})
  0            
85             {
86 0 0         push @report, [$entry, $self->{$entry}]
87             unless ($self->{$entry} =~ /^(false)? *$/i);
88             }
89 0           [@report];
90             }
91              
92              
93             1;