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   68 use strict;
  10         19  
  10         291  
4 10     10   49 use warnings;
  10         17  
  10         4504  
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 30 my $class = shift;
21 16   33     63 $class = ref $class || $class;
22 16         36 my $self = bless {}, $class;
23 16         47 $self->_defaults;
24 16         91 return $self;
25             }
26              
27             sub _defaults
28             {
29 16     16   25 my $self = shift;
30 16         48 %{$self} =
  16         231  
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 150 my $self = shift;
56 142         353 return "#hugin_";
57             }
58              
59             sub Parse
60             {
61 5     5 0 10 my $self = shift;
62 5   50     17 my $string = shift || return 0;
63 5         33 my ($key, $value) = $string =~ /^#hugin_([[:alnum:]]+) *(.*)/g;
64 5         16 $self->{$key} = $value;
65 5         12 return 1;
66             }
67              
68             sub Assemble
69             {
70 7     7 0 14 my $self = shift;
71 7         11 my @items;
72 7         13 for my $entry (sort keys %{$self})
  7         103  
73             {
74 142         219 push @items, $self->Identifier . $entry .' '. $self->{$entry};
75             }
76 7 50       96 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             push @report, [$entry, $self->{$entry}]
87 0 0         unless ($self->{$entry} =~ /^(false)? *$/i);
88             }
89 0           [@report];
90             }
91              
92              
93             1;