| 1 | package Panotools::Script::Line::ImageMetadata; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use Panotools::Script::Line; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use vars qw /@ISA/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 10 | @ISA = qw /Panotools::Script::Line/; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | Panotools::Script::Line::ImageMetadata - hugin input image metadata | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | A single input image is described by an 'i' line, this is optionally prefixed | ||||||||||||||||||||||||||||
| 17 | by a '#-hugin' line containing metadata in a key=value format | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | sub Assemble | ||||||||||||||||||||||||||||
| 24 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
Assemble: called CC=4 SCAR=14.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 26 | 10 | $self->_sanitise; | |||||||||||||||||||||||||||
| 27 | 10 | my @tokens; | |||||||||||||||||||||||||||
| 28 | 10 | for my $entry (sort keys %{$self}) | |||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||
| 30 | 10 | ▶ | if ($entry eq "disabled") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||
| 32 | 0 | push @tokens, $entry; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | else | ||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 10 | push @tokens, $entry .'='. $self->{$entry}; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 10 | ▶ | return (join ' ', ($self->Identifier, @tokens)) ."\n" if (@tokens); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | return ''; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub _defaults | ||||||||||||||||||||||||||||
| 44 | 25 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_defaults: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | 25 | my $self = shift; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 60 | ▶ | sub _valid { return '^([^=]+)(?:=(.*)|)$' } | ||||||||||||||||||||||||||
|
Subroutine
_valid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | sub Identifier | ||||||||||||||||||||||||||||
| 51 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
Identifier: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 53 | 10 | return "#-hugin"; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub _sanitise | ||||||||||||||||||||||||||||
| 57 | 35 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_sanitise: called CC=4 SCAR=14.9
| |||||||||||||||||||||||||||||
| 58 | 35 | my $self = shift; | |||||||||||||||||||||||||||
| 59 | 35 | my $valid = $self->_valid; | |||||||||||||||||||||||||||
| 60 | 35 | for my $key (keys %{$self}) | |||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | 35 | ▶ | delete $self->{$key} unless ( grep /$valid/, "$key=" || grep /$valid/, "$key" ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
"$key=" || grep(/$valid/, "$key")
MC/DC0%0/2
"$key=" || grep(/$valid/, "$key")
"$key="
grep(/$valid/, "$key")
Truth table33%1/3
A || B
A= "$key="B= grep(/$valid/, "$key")
| |||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | sub Report | ||||||||||||||||||||||||||||
| 67 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
Report: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 69 | 0 | my @report; | |||||||||||||||||||||||||||
| 70 | 0 | for my $entry (sort keys %{$self}) | |||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($entry eq "disabled") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||
| 74 | 0 | push @report, ["State",$entry]; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | else | ||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||
| 78 | 0 | my @tokens = $entry =~ /(^[a-z]+|[A-Z][a-z]+|[A-Z][A-Z]+(?=[A-Z][a-z]))/g; | |||||||||||||||||||||||||||
| 79 | 0 | my $name = join ' ', @tokens; | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | push @report, [$name, $self->{$entry}] unless ($self->{$entry} =~ /false/i); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | [@report]; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 10 | 1; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||