| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Panotools::Script::Line; |
|
2
|
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
83
|
use strict; |
|
|
15
|
|
|
|
|
32
|
|
|
|
15
|
|
|
|
|
506
|
|
|
4
|
15
|
|
|
15
|
|
77
|
use warnings; |
|
|
15
|
|
|
|
|
30
|
|
|
|
15
|
|
|
|
|
741
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
33190
|
use Storable qw/ dclone /; |
|
|
15
|
|
|
|
|
84874
|
|
|
|
15
|
|
|
|
|
10654
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Panotools::Script::Line - Panorama Tools script data |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Base class for a line in a panotools script |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
A line starts with a single letter identifier then a series of |
|
19
|
|
|
|
|
|
|
namevalue items separated by whitespace |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 USAGE |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $line = new Panotools::Script::Line::Foo; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
343
|
|
|
343
|
0
|
5854
|
my $class = shift; |
|
30
|
343
|
|
33
|
|
|
1369
|
$class = ref $class || $class; |
|
31
|
343
|
|
|
|
|
1081
|
my $self = bless {}, $class; |
|
32
|
343
|
|
|
|
|
1183
|
$self->_defaults; |
|
33
|
343
|
|
|
|
|
919
|
return $self; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $identifier = $line->Identifier; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub Identifier |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
0
|
|
|
0
|
0
|
0
|
return '#'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$line->Parse ('f a1.0 b2.0 bar3.0'); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub Parse |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
281
|
|
|
281
|
0
|
8777
|
my $self = shift; |
|
56
|
281
|
|
50
|
|
|
1929
|
my $string = shift || return 0; |
|
57
|
281
|
|
|
|
|
682
|
my $valid = $self->_valid; |
|
58
|
281
|
|
|
|
|
4214
|
my @res = $string =~ / ([a-zA-Z][^ "]+)|([a-zA-Z][a-z]*"[^"]+")/g; |
|
59
|
281
|
|
|
|
|
745
|
for my $token (grep { defined $_ } @res) |
|
|
4726
|
|
|
|
|
8420
|
|
|
60
|
|
|
|
|
|
|
{ |
|
61
|
2363
|
|
|
|
|
23272
|
my ($key, $value) = $token =~ /$valid/; |
|
62
|
2363
|
100
|
|
|
|
8788
|
next unless defined $key; |
|
63
|
2322
|
|
|
|
|
7121
|
$self->{$key} = $value; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
281
|
|
|
|
|
815
|
$self->_sanitise; |
|
66
|
281
|
|
|
|
|
1158
|
return 1; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $string = $line->Assemble; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub Assemble |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
113
|
|
|
113
|
0
|
13677
|
my $self = shift; |
|
78
|
113
|
|
|
|
|
661
|
$self->_sanitise; |
|
79
|
113
|
|
|
|
|
385
|
my @tokens; |
|
80
|
113
|
|
|
|
|
687
|
for my $entry (sort keys %{$self}) |
|
|
113
|
|
|
|
|
1329
|
|
|
81
|
|
|
|
|
|
|
{ |
|
82
|
764
|
|
|
|
|
5821
|
push @tokens, $entry . $self->{$entry}; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
113
|
50
|
|
|
|
565
|
return (join ' ', ($self->Identifier, @tokens)) ."\n" if (@tokens); |
|
85
|
0
|
|
|
|
|
0
|
return ''; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$line->Set (a => 'something', b => 2); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub Set |
|
95
|
|
|
|
|
|
|
{ |
|
96
|
9
|
|
|
9
|
0
|
23
|
my $self = shift; |
|
97
|
9
|
|
|
|
|
61
|
my %hash = @_; |
|
98
|
9
|
|
|
|
|
50
|
for my $entry (sort keys %hash) |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
59
|
|
|
|
|
102
|
$self->{$entry} = $hash{$entry}; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
9
|
|
|
|
|
46
|
$self->_sanitise; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=pod |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Clone a line object |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$clone = $l->Clone; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub Clone |
|
114
|
|
|
|
|
|
|
{ |
|
115
|
82
|
|
|
82
|
0
|
99
|
my $self = shift; |
|
116
|
82
|
|
|
|
|
9868
|
dclone ($self); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
19
|
|
|
19
|
|
34
|
sub _defaults {} |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
|
0
|
sub _valid { return '^(.)(.*)' } |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _sanitise |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
416
|
|
|
416
|
|
561
|
my $self = shift; |
|
126
|
416
|
|
|
|
|
2087
|
my $valid = $self->_valid; |
|
127
|
416
|
|
|
|
|
517
|
for my $key (keys %{$self}) |
|
|
416
|
|
|
|
|
2787
|
|
|
128
|
|
|
|
|
|
|
{ |
|
129
|
3873
|
100
|
|
|
|
34417
|
delete $self->{$key} unless (grep /$valid/, $key); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
|
134
|
|
|
|
|
|
|
|