Quiq/TimeLapse/File.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 70.0% 7 / 10 Podpod 100% 5 / 5 totaltotal 65.3% 34 / 52 CC 3 SCAR 10.1
CC
3
Cov
67%
width
6.0
height
6.0
text
2.0
CRAP 2.8
« Quiq/Gd/Component/ColorLegend.pm ↑ Summary Quiq/Stopwatch.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::TimeLapse::File - Bildsequenz-Datei
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::File::Image>
12  
13 =head1 SYNOPSIS
14  
15 # Klasse laden
16 use %CLASS;
17
18 # Instantiiere Bilddatei-Objekt
19 $img = Quiq::TimeLapse::File->new('/my/image/dir/000219-3000x2250-G0080108.jpg');
20
21 # Nummer
22 $n = $img->number; # 219
23
24 # Breite
25 $width = $img->width; # 3000
26
27 # Höhe
28 $height = $img->height; # 2250
29
30 # Name
31 $name = $img->name; # 'G0080108'
32
33 # weitere Methoden siehe Basisklasse
34  
35 =head1 DESCRIPTION
36  
37 Ein Objekt der Klasse repräsentiert eine Bilddatei, die Teil
38 einer Bildsequenz ist. Der Dateiname hat den Aufbau
39  
40 NNNNNN-WIDTHxHEIGHT[-NAME].EXT
41  
42 Hierbei ist NNNNNN die Bild-Nummer.
43  
44 =cut
45  
46 # -----------------------------------------------------------------------------
47  
48 package Quiq::TimeLapse::File;
49 4 ▶use base qw/Quiq::File::Image/;
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 4 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 4 our $VERSION = '1.240';
56  
57 4 ▶use Quiq::TimeLapse::Filename;
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 # -----------------------------------------------------------------------------
60  
61 =head1 METHODS
62  
63 =head2 Konstruktor
64  
65 =head3 new() - Instantiiere Bilddatei-Objekt
66  
67 =head4 Synopsis
68  
69 $img = $class->new($file);
70  
71 =head4 Arguments
72  
73 =over 4
74  
75 =item $file
76  
77 Pfad der Bilddatei.
78  
79 =back
80  
81 =head4 Returns
82  
83 Referenz auf das Bilddatei-Objekt.
84  
85 =head4 Description
86  
87 Instantiiere Datei $file als Bilddatei-Objekt und liefere eine
88 Referenz auf dieses Objekt zurück.
89  
90 =cut
91  
92 # -----------------------------------------------------------------------------
93  
94 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
95 1 my ($class,$file) = @_;
96  
97 1 my $nam = Quiq::TimeLapse::Filename->new($file);
98  
99 1 my $self = $class->SUPER::new($file);
100 1 $self->add(
101 nam => $nam,
102 rangeKey => '',
103 );
104  
105 1 return $self;
106 }
107  
108 # -----------------------------------------------------------------------------
109  
110 =head2 Objektmethoden
111  
112 Alle weiteren Methoden befinden sich in der Basisklasse (s. Abschnitt
113 L<BASE CLASS|"BASE CLASS">).
114  
115 =head3 number() - Nummer des Bildes
116  
117 =head4 Synopsis
118  
119 $n = $img->number;
120  
121 =head4 Returns
122  
123 Integer >= 1
124  
125 =head4 Description
126  
127 Liefere die Nummer des Bildes als Zahl. Z.B. 47.
128  
129 =cut
130  
131 # -----------------------------------------------------------------------------
132  
133 2 ▶sub number {
Subroutine number: called CC=1 SCAR=0.0
Pod documented
134 2 return shift->{'nam'}->number;
135 }
136  
137 # -----------------------------------------------------------------------------
138  
139 =head3 width() - Breite des Bildes
140  
141 =head4 Synopsis
142  
143 $width = $img->width;
144  
145 =head4 Returns
146  
147 Integer >= 1
148  
149 =head4 Description
150  
151 Liefere die Breite des Bildes.
152  
153 =cut
154  
155 # -----------------------------------------------------------------------------
156  
157 0 ▶sub width {
Subroutine width: not called CC=2 SCAR=17.9
Pod documented
158 0 my $self = shift;
159 0 ▶ return $self->{'nam'}->width || $self->SUPER::width;
Condition0%0/3
$self->{'nam'}->width || $self->SUPER::width
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'nam'}->width || $self->SUPER::width
$self->{'nam'}->width $self->SUPER::width
Truth table0%0/3
A || B
A= $self->{'nam'}->widthB= $self->SUPER::width
ABresult
1X1
011
000
160 }
161  
162 # -----------------------------------------------------------------------------
163  
164 =head3 height() - Höhe des Bildes
165  
166 =head4 Synopsis
167  
168 $height = $img->height;
169  
170 =head4 Returns
171  
172 Integer >= 1
173  
174 =head4 Description
175  
176 Liefere die Höhe des Bildes.
177  
178 =cut
179  
180 # -----------------------------------------------------------------------------
181  
182 0 ▶sub height {
Subroutine height: not called CC=2 SCAR=17.9
Pod documented
183 0 my $self = shift;
184 0 ▶ return $self->{'nam'}->height || $self->SUPER::height;
Condition0%0/3
$self->{'nam'}->height || $self->SUPER::height
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'nam'}->height || $self->SUPER::height
$self->{'nam'}->height $self->SUPER::height
Truth table0%0/3
A || B
A= $self->{'nam'}->heightB= $self->SUPER::height
ABresult
1X1
011
000
185 }
186  
187 # -----------------------------------------------------------------------------
188  
189 =head3 text() - Text des Dateinamens
190  
191 =head4 Synopsis
192  
193 $text = $img->text;
194  
195 =head4 Returns
196  
197 String
198  
199 =head4 Description
200  
201 Liefere den Text des Dateinamens.
202  
203 =cut
204  
205 # -----------------------------------------------------------------------------
206  
207 0 ▶sub text {
Subroutine text: not called CC=1 SCAR=6.9
Pod documented
208 0 return shift->{'nam'}->text;
209 }
210  
211 # -----------------------------------------------------------------------------
212  
213 =head1 VERSION
214  
215 1.240
216  
217 =head1 AUTHOR
218  
219 Frank Seitz, L<http://fseitz.de/>
220  
221 =head1 COPYRIGHT
222  
223 Copyright (C) 2026 Frank Seitz
224  
225 =head1 LICENSE
226  
227 This code is free software; you can redistribute it and/or modify
228 it under the same terms as Perl itself.
229  
230 =cut
231  
232 # -----------------------------------------------------------------------------
233  
234 4 1;
235  
236 # eof
« Quiq/Gd/Component/ColorLegend.pm ↑ Summary Quiq/Stopwatch.pm »