blib/lib/Net/LPR.pm

filter: Statementstmt 3.1% 27 / 870 Branchbran 0.0% 0 / 510 Conditioncond 0.0% 0 / 166 MC/DCmcdc 0.0% 0 / 99 Subroutinesub 16.3% 8 / 49 Podpod 62.5% 25 / 40 totaltotal 3.4% 60 / 1734 CC 315 SCAR 54.1
CC
315
Cov
2%
job_send_data
1056.0
job_mode_text
462.0
job_mode_pr
420.0
CRAP 223.2
↑ Summary
1 package Net::LPR;
2  
3 1 ▶use 5.00500;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use IO::Socket::INET;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Sys::Hostname;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 $VERSION = '1.007';
15  
16 1 my %valid_options = (
17 StrictRFCPorts => 1,
18 RemoteServer => 1,
19 RemotePort => 1,
20 PrintErrors => 1,
21 RaiseErrors => 1,
22 );
23  
24 # Modes:
25 # 1 == ROOT command
26 # 2 == JOB command
27 # 3 == DATA command
28  
29 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
30  
31 0 my $class = shift;
32
33 0 my $k;
34
35 0 for $k (keys %{{ @_ }}) {
36 0 ▶ croak "Invalid argument to Net::LPR->new: '$k'" unless exists($valid_options{$k});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $valid_options{$k} 0 0 0
37 }
38
39 0 my $self = {
40 StrictRFCPorts => 1,
41 RemoteServer => "localhost",
42 RemotePort => 515,
43 PrintErrors => 0,
44 RaiseErrors => 0,
45  
46 Socket => undef,
47 Jobs => {},
48 LastError => "",
49 Mode => 0,
50  
51 @_
52 };
53
54 0 bless $self, $class;
55
56 0 return $self;
57 }
58  
59 0 ▶sub _report {
Subroutine _report: not called CC=3 SCAR=24.8
60  
61 0 my $self = shift;
62 0 my $prob = shift;
63 0 my @cinfo = caller(1);
64 0 my $func = reverse $cinfo[3];
65
66 0 $func =~ s/::.*//g;
67 0 $func = reverse $func;
68 0 my $err = "$func: $prob";
69
70 0 $self->{LastError} = $err;
71 0 ▶ print STDERR ($err) if ($self->{PrintErrors});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PrintErrors"} 0 0 0
72 0 ▶ croak ($err) if ($self->{RaiseErrors});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"RaiseErrors"} 0 0 0
73 }
74  
75 0 ▶sub error {
Subroutine error: not called CC=2 SCAR=17.9
Pod documented
76  
77 0 ▶ croak 'Usage: $lp->error()' if (@_ != 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 0 0
78  
79 0 my $self = shift;
80  
81 0 return $self->{LastError};
82 }
83  
84 0 ▶sub disconnect {
Subroutine disconnect: not called CC=2 SCAR=17.9
Pod documented
85  
86 0 ▶ croak 'Usage: $lp->disconnect()' if (@_ != 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 0 0
87  
88 0 my $self = shift;
89
90 0 undef $self->{Socket};
91
92 0 $self->{Jobs} = {};
93
94 0 return 1;
95 }
96  
97 0 ▶sub connect {
Subroutine connect: not called CC=10 SCAR=47.0
Pod documented
98  
99 0 ▶ croak 'Usage: $lp->connect()' if (@_ != 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 0 0
100  
101 0 my $self = shift;
102  
103 0 ▶ if ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->connected) 0 0 0
104 0 return 1;
105 }
106  
107 0 my $sock;
108  
109 0 ▶ if ($self->{StrictRFCPorts}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'StrictRFCPorts'}) { } 0 0 0
110 0 my $port;
111 0 for $port (721..731) {
112 $sock = new IO::Socket::INET (
113 PeerAddr => $self->{RemoteServer},
114 PeerPort => $self->{RemotePort},
115 0 LocalPort => $port,
116 Proto => 'tcp',
117 ReuseAddr => 1,
118 );
119 0 ▶ last if (defined($sock));
Branch: 1 branch
BranchTrueFalseTotal
if defined $sock 0 0 0
120 0 ▶ last unless ($! =~ /in use|bad file number/i);
Branch: 1 branch
BranchTrueFalseTotal
unless $! =~ /in use|bad file number/i 0 0 0
121 }
122 0 ▶ unless (defined($sock)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sock) 0 0 0
123 0 ▶ if ($!) {
Branch: 1 branch
BranchTrueFalseTotal
if ($!) { } 0 0 0
124 0 $self->_report("Can't establish connection to remote printer ($!)");
125 } else {
126 0 $self->_report("Can't establish connection to remote printer (No local ports available)");
127 }
128 0 return undef;
129 }
130 } else {
131 $sock = new IO::Socket::INET (
132 PeerAddr => $self->{RemoteServer},
133 PeerPort => $self->{RemotePort},
134 0 Proto => 'tcp',
135 ReuseAddr => 1,
136 );
137 0 ▶ unless (defined($sock)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sock) 0 0 0
138 0 $self->_report("Can't establish connection to remote printer ($!)");
139 0 return undef;
140 }
141 }
142
143 0 $sock->autoflush(0);
144
145 0 $self->{Socket} = $sock;
146 0 $self->{Mode} = 1;
147
148 0 return 1;
149 }
150  
151 0 ▶sub connected {
Subroutine connected: not called CC=4 SCAR=30.0
Pod documented
152  
153 0 ▶ croak 'Usage: $lp->connected()' if (@_ != 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 0 0
154  
155 0 my $self = shift;
156  
157 0 ▶ undef $self->{Socket} if (defined($self->{Socket}) && ! $self->{Socket}->opened());
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"Socket"} and not $self->{"Socket"}->opened 0 0 0
Condition0%0/3
defined $self->{"Socket"} and not $self->{"Socket"}->opened
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Socket"} and not $self->{"Socket"}->opened
defined $self->{"Socket"} not $self->{"Socket"}->opened
Truth table0%0/3
A and not(B)
A= defined $self->{"Socket"}B= not $self->{"Socket"}->opened
ABresult
0X0
100
111
158  
159 0 return defined($self->{Socket});
160 }
161  
162 # Daemon commands
163  
164 0 ▶sub print_waiting_jobs {
Subroutine print_waiting_jobs: not called CC=6 SCAR=37.4
Pod documented
165  
166 0 ▶ croak 'Usage: $lp->print_waiting_jobs($queue)' if (@_ != 2);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 0 0 0
167  
168 0 my $self = shift;
169  
170 0 ▶ unless ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->connected) 0 0 0
171 0 $self->_report("Not connected");
172 0 return undef;
173 }
174  
175 0 ▶ unless ($self->{Mode} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 1) 0 0 0
176 0 $self->_report("Not in ROOT command mode");
177 0 return undef;
178 }
179  
180 0 my $queue = shift;
181
182 0 $queue =~ s/[\000-\040\200-\377]//g;
183
184 0 ▶ $self->{Socket}->print("\001$queue\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cA$queue\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
185 0 $self->_report("Error sending command ($!)");
186 0 return undef;
187 };
188 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
189 0 $self->_report("Error flushing buffer ($!)");
190 0 return undef;
191 };
192
193 0 return $self->disconnect();
194 }
195  
196 0 ▶sub send_jobs {
Subroutine send_jobs: not called CC=8 SCAR=42.8
Pod documented
197  
198 0 ▶ croak 'Usage: $lp->send_jobs($queue)' if (@_ != 2);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 0 0 0
199 0 my $self = shift;
200  
201 0 ▶ unless ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->connected) 0 0 0
202 0 $self->_report("Not connected");
203 0 return undef;
204 }
205  
206 0 ▶ unless ($self->{Mode} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 1) 0 0 0
207 0 $self->_report("Not in ROOT command mode");
208 0 return undef;
209 }
210  
211 0 my $queue = shift;
212
213 0 $queue =~ s/[\000-\040\200-\377]//g;
214
215 0 ▶ $self->{Socket}->print("\002$queue\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cB$queue\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
216 0 $self->_report("Error sending command ($!)");
217 0 return undef;
218 };
219
220 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
221 0 $self->_report("Error flushing buffer ($!)");
222 0 return undef;
223 };
224
225 0 my $result;
226
227 0 $result = $self->{Socket}->getc();
228
229 0 ▶ if (length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $result) { } 0 0 0
230 0 $result = unpack("C", $result);
231 } else {
232 0 $self->_report("Error getting result ($!)");
233 0 return undef;
234 };
235
236 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
237 0 $self->_report("Printer reported an error ($result)");
238 0 return undef;
239 }
240
241 0 $self->{Mode} = 2;
242
243 0 return 1;
244 }
245  
246 0 ▶sub get_queue_state {
Subroutine get_queue_state: not called CC=14 SCAR=53.5
Pod documented
247  
248 0 ▶ croak 'Usage: $lp->get_queue_state($queue [, $longflag [, @items]])' if (@_ < 2);
Branch: 1 branch
BranchTrueFalseTotal
if @_ < 2 0 0 0
249
250 0 my $self = shift;
251
252 0 ▶ unless ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->connected) 0 0 0
253 0 $self->_report("Not connected");
254 0 return undef;
255 }
256  
257 0 ▶ unless ($self->{Mode} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 1) 0 0 0
258 0 $self->_report("Not in ROOT command mode");
259 0 return undef;
260 }
261  
262 0 my $queue = shift;
263
264 0 $queue =~ s/[\000-\040\200-\377]//g;
265  
266 0 ▶ my $longflag = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
267
268 0 ▶ my $cmd = $longflag ? "\004" : "\003";
Branch: 1 branch
BranchTrueFalseTotal
$longflag ? : 0 0 0
269  
270 0 ▶ $self->{Socket}->print("$cmd$queue ") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("$cmd$queue ") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
271 0 $self->_report("Error sending command ($!)");
272 0 return undef;
273 };
274  
275 0 my $item;
276
277 0 ▶ while (defined($item = shift)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($item = shift())) 0 0 0
278  
279 0 $item =~ s/[\000-\040\200-\377]//g;
280  
281 0 ▶ $self->{Socket}->print("$item ") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("$item ") or do { $self->_report("Error sending item ($!)"); return undef } 0 0 0
282 0 $self->_report("Error sending item ($!)");
283 0 return undef;
284 };
285 }
286
287 0 ▶ $self->{Socket}->print("\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
288 0 $self->_report("Error sending command ($!)");
289 0 return undef;
290 };
291  
292 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
293 0 $self->_report("Error flushing buffer ($!)");
294 0 return undef;
295 };
296
297 0 my $response = "";
298 0 my $line;
299
300 0 ▶ while (defined($line = $self->{Socket}->getline())) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($line = $self->{"Socket"}->getline)) 0 0 0
301 0 $response .= $line;
302 }
303
304 0 ▶ return ( $self->disconnect() || undef ) && $response;
Condition0%0/5
($self->disconnect || undef) && $response
!ll&&!rl&&r
000
$self->disconnect or undef
l!l
00
MC/DC0%0/2
($self->disconnect || undef) && $response
$self->disconnect $response
Truth table0%0/3
A && B
A= $self->disconnectB= $response
ABresult
0X0
100
111
305 }
306  
307 0 ▶sub remove_jobs {
Subroutine remove_jobs: not called CC=9 SCAR=45.0
Pod documented
308  
309 0 ▶ croak 'Usage: $lp->remove_jobs($queue, $username [, @items])' if (@_ < 3);
Branch: 1 branch
BranchTrueFalseTotal
if @_ < 3 0 0 0
310
311 0 my $self = shift;
312
313 0 ▶ unless ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->connected) 0 0 0
314 0 $self->_report("Not connected");
315 0 return undef;
316 }
317  
318 0 ▶ unless ($self->{Mode} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 1) 0 0 0
319 0 $self->_report("Not in ROOT command mode");
320 0 return undef;
321 }
322  
323 0 my $queue = shift;
324 0 $queue =~ s/[\000-\040\200-\377]//g;
325
326 0 my $username = shift;
327 0 $username =~ s/[\000-\040\200-\377]//g;
328  
329 0 ▶ $self->{Socket}->print("\005$queue $username") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cE$queue $username") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
330 0 $self->_report("Error sending command ($!)");
331 0 return undef;
332 };
333  
334 0 my $item;
335
336 0 ▶ while (defined($item = shift)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($item = shift())) 0 0 0
337  
338 0 $item =~ s/[\000-\040\200-\377]//g;
339  
340 0 ▶ $self->{Socket}->print(" $item") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print(" $item") or do { $self->_report("Error sending item ($!)"); return undef } 0 0 0
341 0 $self->_report("Error sending item ($!)");
342 0 return undef;
343 };
344 }
345
346 0 ▶ $self->{Socket}->print("\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
347 0 $self->_report("Error sending command ($!)");
348 0 return undef;
349 };
350
351 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
352 0 $self->_report("Error flushing buffer ($!)");
353 0 return undef;
354 };
355  
356 0 return $self->disconnect();
357 }
358  
359 #
360 # Job subcommands
361 #
362  
363 0 ▶sub job_abort {
Subroutine job_abort: not called CC=8 SCAR=42.8
Pod undocumented
364  
365 0 ▶ croak 'Usage: $lp->job_abort()' if (@_ != 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 0 0
366
367 0 my $self = shift;
368
369 0 ▶ unless ($self->connected()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->connected) 0 0 0
370 0 $self->_report("Not connected");
371 0 return undef;
372 }
373  
374 0 ▶ unless ($self->{Mode} == 2) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 2) 0 0 0
375 0 $self->_report("Not in JOB command mode");
376 0 return undef;
377 }
378  
379 0 $self->{Jobs} = {};
380  
381 0 ▶ $self->{Socket}->print("\001\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\1\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
382 0 $self->_report("Error sending command ($!)");
383 0 return undef;
384 };
385
386 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
387 0 $self->_report("Error flushing buffer ($!)");
388 0 return undef;
389 };
390
391 0 my $result;
392
393 0 $result = $self->{Socket}->getc();
394
395 0 ▶ if (length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $result) { } 0 0 0
396 0 $result = unpack("C", $result);
397 } else {
398 0 $self->_report("Error getting result ($!)");
399 0 return undef;
400 };
401
402 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
403 0 $self->_report("Printer reported an error ($result)");
404 0 return undef;
405 }
406  
407 0 return 1;
408 }
409  
410 1 my $g_job_id = 0;
411  
412 0 ▶sub new_job {
Subroutine new_job: not called CC=9 SCAR=45.0
Pod documented
413  
414 0 ▶ croak 'Usage: $jobkey = $lp->new_job([$jobid [, $jobhostname]])' if (@_ < 1 || @_ > 3);
Branch: 1 branch
BranchTrueFalseTotal
if @_ < 1 or @_ > 3 0 0 0
Condition0%0/3
@_ < 1 or @_ > 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ < 1 or @_ > 3
@_ < 1 @_ > 3
Truth table0%0/3
A or B
A= @_ < 1B= @_ > 3
ABresult
1X1
011
000
415  
416 0 my $self = shift;
417 0 my $jobid = shift;
418
419 0 ▶ $jobid = $g_job_id unless (defined($jobid));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $jobid 0 0 0
420
421 0 ▶ if ($jobid !~ /^\d+$/ || $jobid > 999) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $jobid =~ /^\d+$/ or $jobid > 999) 0 0 0
Condition0%0/3
not $jobid =~ /^\d+$/ or $jobid > 999
l!l&&r!l&&!r
000
MC/DC0%0/2
not $jobid =~ /^\d+$/ or $jobid > 999
not $jobid =~ /^\d+$/ $jobid > 999
Truth table0%0/3
not(A) or B
A= not $jobid =~ /^\d+$/B= $jobid > 999
ABresult
1X1
011
000
422 0 $self->_report("Invalid Job ID specified");
423 0 return undef;
424 }
425
426 0 $g_job_id = ($jobid + 1) % 1000;
427  
428 0 my $jobname = shift;
429
430 0 ▶ $jobname = hostname() unless (defined($jobname));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $jobname 0 0 0
431
432 0 $jobname =~ s/[\000-\040\200-\377]//g;
433
434 0 my $jobkey = sprintf('%03d%s', $jobid, $jobname);
435
436 0 ▶ if (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"Jobs"}{$jobkey}) 0 0 0
437 0 $self->_report("Duplicate Job ID specified");
438 0 return undef;
439 }
440
441 0 my $user;
442
443 0 ▶ if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 0 0
444 0 $user = getlogin();
445 } else {
446 0 $user = scalar(getpwuid($>));
447 }
448
449 0 $self->{Jobs}->{$jobkey} = {
450 JobID => $jobid,
451 Jobname => $jobname,
452 SentControl => 0,
453 SentData => 0,
454 UsedDataFileName => 0,
455 ControlFileName => "cfA$jobkey",
456 DataFileName => "dfA$jobkey",
457 PrintingMode => '',
458 DataSize => 0,
459 DataSent => 0,
460 CE => {
461 H => hostname(),
462 P => $user,
463 },
464 };
465
466 0 return $jobkey;
467 }
468  
469 0 ▶sub job_get_data_filename {
Subroutine job_get_data_filename: not called CC=3 SCAR=24.8
Pod documented
470  
471 0 ▶ croak 'Usage: $lp->job_get_data_filename($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
472
473 0 my $self = shift;
474 0 my $jobkey = shift;
475
476 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
477 0 $self->_report("Nonexistant Job Key '$jobkey'");
478 0 return undef;
479 }
480  
481 0 return $self->{Jobs}->{$jobkey}->{DataFileName};
482 }
483  
484 0 ▶sub job_set_data_filename {
Subroutine job_set_data_filename: not called CC=7 SCAR=40.3
Pod documented
485  
486 0 ▶ croak 'Usage: $lp->job_set_data_filename($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
487
488 0 my $self = shift;
489 0 my $jobkey = shift;
490
491 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
492 0 $self->_report("Nonexistant Job Key '$jobkey'");
493 0 return undef;
494 }
495  
496 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
497 0 $self->_report("Already sent control file for '$jobkey'");
498 0 return undef;
499 }
500  
501 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentData}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentData"}) 0 0 0
502 0 $self->_report("Already sent data file for '$jobkey'");
503 0 return undef;
504 }
505  
506 0 ▶ if ($self->{Jobs}->{$jobkey}->{UsedDataFileName}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"UsedDataFileName"}) 0 0 0
507 0 $self->_report("Already referenced existing data file name for '$jobkey'");
508 0 return undef;
509 }
510  
511 0 my $text = shift;
512  
513 0 $text =~ s/[\000-\040\200-\377]//g;
514
515 0 ▶ if (length($text) < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $text < 1) 0 0 0
516 0 $self->_report("File name must be at least one character");
517 0 return undef;
518 }
519
520 0 $self->{Jobs}->{$jobkey}->{DataFileName} = $text;
521  
522 0 return 1;
523 }
524  
525 0 ▶sub job_get_control_filename {
Subroutine job_get_control_filename: not called CC=3 SCAR=24.8
Pod documented
526  
527 0 ▶ croak 'Usage: $lp->job_get_control_filename($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
528
529 0 my $self = shift;
530 0 my $jobkey = shift;
531
532 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
533 0 $self->_report("Nonexistant Job Key '$jobkey'");
534 0 return undef;
535 }
536  
537 0 return $self->{Jobs}->{$jobkey}->{ControlFileName};
538 }
539  
540 0 ▶sub job_set_control_filename {
Subroutine job_set_control_filename: not called CC=6 SCAR=37.4
Pod documented
541  
542 0 ▶ croak 'Usage: $lp->job_set_control_filename($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
543
544 0 my $self = shift;
545 0 my $jobkey = shift;
546
547 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
548 0 $self->_report("Nonexistant Job Key '$jobkey'");
549 0 return undef;
550 }
551  
552 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
553 0 $self->_report("Already sent control file for '$jobkey'");
554 0 return undef;
555 }
556  
557 0 ▶ if ($self->{Jobs}->{$jobkey}->{UsedDataFileName}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"UsedDataFileName"}) 0 0 0
558 0 $self->_report("Already referenced existing data file name for '$jobkey'");
559 0 return undef;
560 }
561  
562 0 my $text = shift;
563  
564 0 $text =~ s/[\000-\040\200-\377]//g;
565
566 0 ▶ if (length($text) < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $text < 1) 0 0 0
567 0 $self->_report("File name must be at least one character");
568 0 return undef;
569 }
570
571 0 $self->{Jobs}->{$jobkey}->{ControlFileName} = $text;
572  
573 0 return 1;
574 }
575  
576 0 ▶sub job_set_banner_class {
Subroutine job_set_banner_class: not called CC=6 SCAR=37.4
Pod documented
577  
578 0 ▶ croak 'Usage: $lp->job_set_banner_class($jobkey, $text)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
579
580 0 my $self = shift;
581 0 my $jobkey = shift;
582
583 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
584 0 $self->_report("Nonexistant Job Key '$jobkey'");
585 0 return undef;
586 }
587  
588 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
589 0 $self->_report("Already sent control file for '$jobkey'");
590 0 return undef;
591 }
592  
593 0 my $text = shift;
594  
595 0 $text =~ s/[\000-\040\200-\377]//g;
596
597 0 ▶ unless (length($text) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 32) 0 0 0
598 0 $self->_report("Banner Class is too long (31 octet limit)");
599 0 return undef;
600 }
601
602 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
603 0 $self->_report("Banner Class is too short (1 octet minimum)");
604 0 return undef;
605 }
606
607 0 $self->{Jobs}->{$jobkey}->{CE}->{C} = $text;
608  
609 0 return 1;
610 }
611  
612 0 ▶sub job_set_hostname {
Subroutine job_set_hostname: not called CC=5 SCAR=34.0
Pod documented
613  
614 0 ▶ croak 'Usage: $lp->job_set_hostname($jobkey, $hostname)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
615
616 0 my $self = shift;
617
618 0 my $jobkey = shift;
619
620 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
621 0 $self->_report("Nonexistant Job Key '$jobkey'");
622 0 return undef;
623 }
624  
625 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
626 0 $self->_report("Already sent control file for '$jobkey'");
627 0 return undef;
628 }
629  
630 0 my $text = shift;
631  
632 0 $text =~ s/[\000-\040\200-\377]//g;
633
634 0 ▶ unless (length($text) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 32) 0 0 0
635 0 $self->_report("Hostname is too long (31 octet limit)");
636 0 return undef;
637 }
638
639 0 $self->{Jobs}->{$jobkey}->{CE}->{H} = $text;
640  
641 0 return 1;
642 }
643  
644 0 ▶sub job_set_banner_name {
Subroutine job_set_banner_name: not called CC=6 SCAR=37.4
Pod documented
645  
646 0 ▶ croak 'Usage: $lp->job_set_banner_name($jobkey, $name)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
647
648 0 my $self = shift;
649
650 0 my $jobkey = shift;
651
652 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
653 0 $self->_report("Nonexistant Job Key '$jobkey'");
654 0 return undef;
655 }
656  
657 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
658 0 $self->_report("Already sent control file for '$jobkey'");
659 0 return undef;
660 }
661  
662 0 my $text = shift;
663  
664 0 $text =~ s/[\000-\040\200-\377]//g;
665
666 0 ▶ unless (length($text) < 100) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 100) 0 0 0
667 0 $self->_report("Banner Name is too long (99 octet limit)");
668 0 return undef;
669 }
670
671 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
672 0 $self->_report("Banner Name is too short (1 octet minimum)");
673 0 return undef;
674 }
675
676 0 $self->{Jobs}->{$jobkey}->{CE}->{J} = $text;
677  
678 0 return 1;
679 }
680  
681 0 ▶sub job_enable_banner_page {
Subroutine job_enable_banner_page: not called CC=6 SCAR=37.4
Pod documented
682  
683 0 ▶ croak 'Usage: $lp->job_enable_banner_page($jobkey, $username)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
684
685 0 my $self = shift;
686
687 0 my $jobkey = shift;
688
689 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
690 0 $self->_report("Nonexistant Job Key '$jobkey'");
691 0 return undef;
692 }
693  
694 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
695 0 $self->_report("Already sent control file for '$jobkey'");
696 0 return undef;
697 }
698  
699 0 my $text = shift;
700  
701 0 $text =~ s/[\000-\040\200-\377]//g;
702
703 0 ▶ unless (length($text) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 32) 0 0 0
704 0 $self->_report("Banner User Name is too long (31 octet limit)");
705 0 return undef;
706 }
707
708 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
709 0 $self->_report("Banner User Name is too short (1 octet minimum)");
710 0 return undef;
711 }
712
713 0 $self->{Jobs}->{$jobkey}->{CE}->{L} = $text;
714  
715 0 return 1;
716 }
717  
718 0 ▶sub job_mail_when_printed {
Subroutine job_mail_when_printed: not called CC=6 SCAR=37.4
Pod documented
719  
720 0 ▶ croak 'Usage: $lp->job_mail_when_printed($jobkey, $username)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
721
722 0 my $self = shift;
723
724 0 my $jobkey = shift;
725
726 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
727 0 $self->_report("Nonexistant Job Key '$jobkey'");
728 0 return undef;
729 }
730  
731 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
732 0 $self->_report("Already sent control file for '$jobkey'");
733 0 return undef;
734 }
735  
736 0 my $text = shift;
737  
738 0 $text =~ s/[\000-\040\200-\377]//g;
739
740 0 ▶ unless (length($text) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 32) 0 0 0
741 0 $self->_report("Mail User Name is too long (31 octet limit)");
742 0 return undef;
743 }
744
745 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
746 0 $self->_report("Mail User Name is too short (1 octet minimum)");
747 0 return undef;
748 }
749
750 0 $self->{Jobs}->{$jobkey}->{CE}->{M} = $text;
751  
752 0 return 1;
753 }
754  
755 0 ▶sub job_set_source_filename {
Subroutine job_set_source_filename: not called CC=6 SCAR=37.4
Pod documented
756  
757 0 ▶ croak 'Usage: $lp->job_set_source_filename($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
758
759 0 my $self = shift;
760
761 0 my $jobkey = shift;
762
763 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
764 0 $self->_report("Nonexistant Job Key '$jobkey'");
765 0 return undef;
766 }
767  
768 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
769 0 $self->_report("Already sent control file for '$jobkey'");
770 0 return undef;
771 }
772  
773 0 my $text = shift;
774  
775 0 $text =~ s/[\000-\040\200-\377]//g;
776
777 0 ▶ unless (length($text) < 132) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 132) 0 0 0
778 0 $self->_report("Filename is too long (131 octet limit)");
779 0 return undef;
780 }
781
782 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
783 0 $self->_report("Filename is too short (1 octet minimum)");
784 0 return undef;
785 }
786
787 0 $self->{Jobs}->{$jobkey}->{CE}->{N} = $text;
788  
789 0 return 1;
790 }
791  
792 0 ▶sub job_set_user_id {
Subroutine job_set_user_id: not called CC=6 SCAR=37.4
Pod documented
793  
794 0 ▶ croak 'Usage: $lp->job_set_user_id($jobkey, $username)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
795
796 0 my $self = shift;
797
798 0 my $jobkey = shift;
799
800 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
801 0 $self->_report("Nonexistant Job Key '$jobkey'");
802 0 return undef;
803 }
804  
805 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
806 0 $self->_report("Already sent control file for '$jobkey'");
807 0 return undef;
808 }
809  
810 0 my $text = shift;
811  
812 0 $text =~ s/[\000-\040\200-\377]//g;
813
814 0 ▶ unless (length($text) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 32) 0 0 0
815 0 $self->_report("User Name is too long (31 octet limit)");
816 0 return undef;
817 }
818
819 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
820 0 $self->_report("User Name is too short (1 octet minimum)");
821 0 return undef;
822 }
823
824 0 $self->{Jobs}->{$jobkey}->{CE}->{P} = $text;
825  
826 0 return 1;
827 }
828  
829 0 ▶sub job_set_symlink_data {
Subroutine job_set_symlink_data: not called CC=6 SCAR=37.4
Pod documented
830  
831 0 ▶ croak 'Usage: $lp->job_set_symlink_data($jobkey, $dev, $inode)' unless (@_ == 4);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 4 0 0 0
832
833 0 my $self = shift;
834
835 0 my $jobkey = shift;
836
837 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
838 0 $self->_report("Nonexistant Job Key '$jobkey'");
839 0 return undef;
840 }
841  
842 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
843 0 $self->_report("Already sent control file for '$jobkey'");
844 0 return undef;
845 }
846  
847 0 my $dev = shift;
848 0 my $inode = shift;
849
850 0 ▶ unless ($dev =~ /^\d+$/ && $inode =~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dev =~ /^\d+$/ and $inode =~ /^\d+$/) 0 0 0
Condition0%0/3
$dev =~ /^\d+$/ and $inode =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
$dev =~ /^\d+$/ and $inode =~ /^\d+$/
$dev =~ /^\d+$/ $inode =~ /^\d+$/
Truth table0%0/3
A and B
A= $dev =~ /^\d+$/B= $inode =~ /^\d+$/
ABresult
0X0
100
111
851 0 $self->_report("Expected numeric arguments");
852 0 return undef;
853 }
854
855 0 $self->{Jobs}->{$jobkey}->{CE}->{S} = "$dev $inode";
856  
857 0 return 1;
858 }
859  
860 0 ▶sub job_unlink {
Subroutine job_unlink: not called CC=4 SCAR=30.0
Pod documented
861  
862 0 ▶ croak 'Usage: $lp->job_unlink($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
863
864 0 my $self = shift;
865
866 0 my $jobkey = shift;
867
868 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
869 0 $self->_report("Nonexistant Job Key '$jobkey'");
870 0 return undef;
871 }
872  
873 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
874 0 $self->_report("Already sent control file for '$jobkey'");
875 0 return undef;
876 }
877  
878 0 $self->{Jobs}->{$jobkey}->{UsedDataFileName} = 1;
879
880 0 $self->{Jobs}->{$jobkey}->{CE}->{P} = $self->{Jobs}->{$jobkey}->{DataFileName};
881  
882 0 return 1;
883 }
884  
885 0 ▶sub job_set_troff_r_font {
Subroutine job_set_troff_r_font: not called CC=6 SCAR=37.4
Pod undocumented
886  
887 0 ▶ croak 'Usage: $lp->job_set_troff_r_font($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
888
889 0 my $self = shift;
890
891 0 my $jobkey = shift;
892
893 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
894 0 $self->_report("Nonexistant Job Key '$jobkey'");
895 0 return undef;
896 }
897  
898 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
899 0 $self->_report("Already sent control file for '$jobkey'");
900 0 return undef;
901 }
902  
903 0 my $text = shift;
904  
905 0 $text =~ s/[\000-\040\200-\377]//g;
906
907 0 ▶ unless (length($text) < 256) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 256) 0 0 0
908 0 $self->_report("File Name is too long (255 octet limit)");
909 0 return undef;
910 }
911
912 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
913 0 $self->_report("File Name is too short (1 octet minimum)");
914 0 return undef;
915 }
916
917 0 $self->{Jobs}->{$jobkey}->{CE}->{1} = $text;
918  
919 0 return 1;
920 }
921  
922 0 ▶sub job_set_troff_i_font {
Subroutine job_set_troff_i_font: not called CC=6 SCAR=37.4
Pod undocumented
923  
924 0 ▶ croak 'Usage: $lp->job_set_troff_i_font($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
925
926 0 my $self = shift;
927
928 0 my $jobkey = shift;
929
930 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
931 0 $self->_report("Nonexistant Job Key '$jobkey'");
932 0 return undef;
933 }
934  
935 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
936 0 $self->_report("Already sent control file for '$jobkey'");
937 0 return undef;
938 }
939  
940 0 my $text = shift;
941  
942 0 $text =~ s/[\000-\040\200-\377]//g;
943
944 0 ▶ unless (length($text) < 256) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 256) 0 0 0
945 0 $self->_report("File Name is too long (255 octet limit)");
946 0 return undef;
947 }
948
949 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
950 0 $self->_report("File Name is too short (1 octet minimum)");
951 0 return undef;
952 }
953
954 0 $self->{Jobs}->{$jobkey}->{CE}->{2} = $text;
955  
956 0 return 1;
957 }
958  
959 0 ▶sub job_set_troff_b_font {
Subroutine job_set_troff_b_font: not called CC=6 SCAR=37.4
Pod undocumented
960  
961 0 ▶ croak 'Usage: $lp->job_set_troff_b_font($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
962
963 0 my $self = shift;
964
965 0 my $jobkey = shift;
966
967 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
968 0 $self->_report("Nonexistant Job Key '$jobkey'");
969 0 return undef;
970 }
971  
972 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
973 0 $self->_report("Already sent control file for '$jobkey'");
974 0 return undef;
975 }
976  
977 0 my $text = shift;
978  
979 0 $text =~ s/[\000-\040\200-\377]//g;
980
981 0 ▶ unless (length($text) < 256) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 256) 0 0 0
982 0 $self->_report("File Name is too long (255 octet limit)");
983 0 return undef;
984 }
985
986 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
987 0 $self->_report("File Name is too short (1 octet minimum)");
988 0 return undef;
989 }
990
991 0 $self->{Jobs}->{$jobkey}->{CE}->{3} = $text;
992  
993 0 return 1;
994 }
995  
996 0 ▶sub job_set_troff_s_font {
Subroutine job_set_troff_s_font: not called CC=6 SCAR=37.4
Pod undocumented
997  
998 0 ▶ croak 'Usage: $lp->job_set_troff_s_font($jobkey, $filename)' unless (@_ == 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
999
1000 0 my $self = shift;
1001
1002 0 my $jobkey = shift;
1003
1004 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1005 0 $self->_report("Nonexistant Job Key '$jobkey'");
1006 0 return undef;
1007 }
1008  
1009 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1010 0 $self->_report("Already sent control file for '$jobkey'");
1011 0 return undef;
1012 }
1013  
1014 0 my $text = shift;
1015  
1016 0 $text =~ s/[\000-\040\200-\377]//g;
1017
1018 0 ▶ unless (length($text) < 256) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text < 256) 0 0 0
1019 0 $self->_report("File Name is too long (255 octet limit)");
1020 0 return undef;
1021 }
1022
1023 0 ▶ unless (length($text) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $text > 0) 0 0 0
1024 0 $self->_report("File Name is too short (1 octet minimum)");
1025 0 return undef;
1026 }
1027
1028 0 $self->{Jobs}->{$jobkey}->{CE}->{4} = $text;
1029  
1030 0 return 1;
1031 }
1032  
1033 0 ▶sub job_mode_cif {
Subroutine job_mode_cif: not called CC=12 SCAR=50.5
Pod undocumented
1034  
1035 0 ▶ croak 'Usage: $lp->job_mode_cif($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1036
1037 0 my $self = shift;
1038
1039 0 my $jobkey = shift;
1040
1041 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1042 0 $self->_report("Nonexistant Job Key '$jobkey'");
1043 0 return undef;
1044 }
1045  
1046 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1047 0 $self->_report("Already sent control file for '$jobkey'");
1048 0 return undef;
1049 }
1050  
1051 0 my $job = $self->{Jobs}->{$jobkey};
1052  
1053 0 my $f = $job->{PrintFormat};
1054  
1055 0 $job->{UsedDataFileName} = 1;
1056
1057 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1058 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1059 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1060 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1061 0 delete $job->{CE}->{$f};
1062 }
1063
1064 0 $job->{PrintFormat} = 'c';
1065
1066 0 $job->{CE}->{c} = $job->{DataFileName};
1067  
1068 0 return 1;
1069 }
1070  
1071 0 ▶sub job_mode_dvi {
Subroutine job_mode_dvi: not called CC=12 SCAR=50.5
Pod undocumented
1072  
1073 0 ▶ croak 'Usage: $lp->job_mode_dvi($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1074
1075 0 my $self = shift;
1076
1077 0 my $jobkey = shift;
1078
1079 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1080 0 $self->_report("Nonexistant Job Key '$jobkey'");
1081 0 return undef;
1082 }
1083  
1084 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1085 0 $self->_report("Already sent control file for '$jobkey'");
1086 0 return undef;
1087 }
1088  
1089 0 my $job = $self->{Jobs}->{$jobkey};
1090  
1091 0 my $f = $job->{PrintFormat};
1092  
1093 0 $job->{UsedDataFileName} = 1;
1094
1095 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1096 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1097 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1098 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1099 0 delete $job->{CE}->{$f};
1100 }
1101
1102 0 $job->{PrintFormat} = 'd';
1103
1104 0 $job->{CE}->{d} = $job->{DataFileName};
1105  
1106 0 return 1;
1107 }
1108  
1109 0 ▶sub job_mode_text {
Subroutine job_mode_text: not called CC=21 SCAR=61.4
Pod undocumented
1110  
1111 0 ▶ croak 'Usage: $lp->job_mode_text($jobkey [, $width [, $indentation [, $nofilter]]])' unless (@_ >= 2 && @_ <= 5);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ >= 2 and @_ <= 5 0 0 0
Condition0%0/3
@_ >= 2 and @_ <= 5
!ll&&!rl&&r
000
MC/DC0%0/2
@_ >= 2 and @_ <= 5
@_ >= 2 @_ <= 5
Truth table0%0/3
A and B
A= @_ >= 2B= @_ <= 5
ABresult
0X0
100
111
1112
1113 0 my $self = shift;
1114
1115 0 my $jobkey = shift;
1116
1117 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1118 0 $self->_report("Nonexistant Job Key '$jobkey'");
1119 0 return undef;
1120 }
1121  
1122 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1123 0 $self->_report("Already sent control file for '$jobkey'");
1124 0 return undef;
1125 }
1126  
1127 0 my $width = shift;
1128
1129 0 ▶ if (defined($width) && $width !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $width and not $width =~ /^\d+$/) 0 0 0
Condition0%0/3
defined $width and not $width =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $width and not $width =~ /^\d+$/
defined $width not $width =~ /^\d+$/
Truth table0%0/3
A and not(B)
A= defined $widthB= not $width =~ /^\d+$/
ABresult
0X0
100
111
1130 0 $self->_report("Width argument must be numeric");
1131 0 return undef;
1132 }
1133
1134 0 my $indentation = shift;
1135  
1136 0 ▶ if (defined($indentation) && $indentation !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $indentation and not $indentation =~ /^\d+$/) 0 0 0
Condition0%0/3
defined $indentation and not $indentation =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $indentation and not $indentation =~ /^\d+$/
defined $indentation not $indentation =~ /^\d+$/
Truth table0%0/3
A and not(B)
A= defined $indentationB= not $indentation =~ /^\d+$/
ABresult
0X0
100
111
1137 0 $self->_report("Indentation argument must be numeric");
1138 0 return undef;
1139 }
1140
1141 0 my $nofilter = shift;
1142
1143 0 my $job = $self->{Jobs}->{$jobkey};
1144  
1145 0 my $f = $job->{PrintFormat};
1146  
1147 0 $job->{UsedDataFileName} = 1;
1148
1149 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1150 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1151 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1152 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1153 0 delete $job->{CE}->{$f};
1154 }
1155
1156 0 ▶ if (defined($nofilter) && $nofilter) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nofilter and $nofilter) { } 0 0 0
Condition0%0/3
defined $nofilter and $nofilter
!ll&&!rl&&r
000
MC/DC0%0/2
defined $nofilter and $nofilter
defined $nofilter $nofilter
Truth table0%0/3
A and B
A= defined $nofilterB= $nofilter
ABresult
0X0
100
111
1157 0 $f = 'l';
1158 } else {
1159 0 $f = 'f';
1160 }
1161
1162 0 $job->{PrintFormat} = $f;
1163
1164 0 $job->{CE}->{$f} = $job->{DataFileName};
1165 0 ▶ $job->{CE}->{W} = $width if (defined($width));
Branch: 1 branch
BranchTrueFalseTotal
if defined $width 0 0 0
1166 0 ▶ $job->{CE}->{I} = $indentation if (defined($indentation));
Branch: 1 branch
BranchTrueFalseTotal
if defined $indentation 0 0 0
1167  
1168 0 return 1;
1169 }
1170  
1171 0 ▶sub job_mode_plot {
Subroutine job_mode_plot: not called CC=11 SCAR=48.8
Pod undocumented
1172  
1173 0 ▶ croak 'Usage: $lp->job_mode_plot($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1174
1175 0 my $self = shift;
1176
1177 0 my $jobkey = shift;
1178
1179 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1180 0 $self->_report("Nonexistant Job Key '$jobkey'");
1181 0 return undef;
1182 }
1183  
1184 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1185 0 $self->_report("Already sent control file for '$jobkey'");
1186 0 return undef;
1187 }
1188  
1189 0 my $job = $self->{Jobs}->{$jobkey};
1190  
1191 0 my $f = $job->{PrintFormat};
1192  
1193 0 $job->{UsedDataFileName} = 1;
1194
1195 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1196 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1197 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1198 0 ▶ delete $job->{CE}->{I} if ($f eq 'f');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" 0 0 0
1199 0 delete $job->{CE}->{$f};
1200 }
1201
1202 0 $job->{PrintFormat} = 'g';
1203
1204 0 $job->{CE}->{g} = $job->{DataFileName};
1205  
1206 0 return 1;
1207 }
1208  
1209 0 ▶sub job_mode_ditroff {
Subroutine job_mode_ditroff: not called CC=12 SCAR=50.5
Pod undocumented
1210  
1211 0 ▶ croak 'Usage: $lp->job_mode_ditroff($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1212
1213 0 my $self = shift;
1214
1215 0 my $jobkey = shift;
1216
1217 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1218 0 $self->_report("Nonexistant Job Key '$jobkey'");
1219 0 return undef;
1220 }
1221  
1222 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1223 0 $self->_report("Already sent control file for '$jobkey'");
1224 0 return undef;
1225 }
1226  
1227 0 my $job = $self->{Jobs}->{$jobkey};
1228  
1229 0 my $f = $job->{PrintFormat};
1230  
1231 0 $job->{UsedDataFileName} = 1;
1232
1233 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1234 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1235 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1236 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1237 0 delete $job->{CE}->{$f};
1238 }
1239
1240 0 $job->{PrintFormat} = 'n';
1241
1242 0 $job->{CE}->{n} = $job->{DataFileName};
1243  
1244 0 return 1;
1245 }
1246  
1247 0 ▶sub job_mode_postscript {
Subroutine job_mode_postscript: not called CC=12 SCAR=50.5
Pod undocumented
1248  
1249 0 ▶ croak 'Usage: $lp->job_mode_postscript($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1250
1251 0 my $self = shift;
1252
1253 0 my $jobkey = shift;
1254
1255 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1256 0 $self->_report("Nonexistant Job Key '$jobkey'");
1257 0 return undef;
1258 }
1259  
1260 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1261 0 $self->_report("Already sent control file for '$jobkey'");
1262 0 return undef;
1263 }
1264  
1265 0 my $job = $self->{Jobs}->{$jobkey};
1266  
1267 0 my $f = $job->{PrintFormat};
1268  
1269 0 $job->{UsedDataFileName} = 1;
1270
1271 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1272 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1273 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1274 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1275 0 delete $job->{CE}->{$f};
1276 }
1277
1278 0 $job->{PrintFormat} = 'o';
1279
1280 0 $job->{CE}->{o} = $job->{DataFileName};
1281  
1282 0 return 1;
1283 }
1284  
1285 0 ▶sub job_mode_pr {
Subroutine job_mode_pr: not called CC=20 SCAR=60.4
Pod undocumented
1286  
1287 0 ▶ croak 'Usage: $lp->job_mode_pr($jobkey [, $title [, $width]])' unless (@_ >= 2 && @_ <= 4);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ >= 2 and @_ <= 4 0 0 0
Condition0%0/3
@_ >= 2 and @_ <= 4
!ll&&!rl&&r
000
MC/DC0%0/2
@_ >= 2 and @_ <= 4
@_ >= 2 @_ <= 4
Truth table0%0/3
A and B
A= @_ >= 2B= @_ <= 4
ABresult
0X0
100
111
1288
1289 0 my $self = shift;
1290
1291 0 my $jobkey = shift;
1292
1293 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1294 0 $self->_report("Nonexistant Job Key '$jobkey'");
1295 0 return undef;
1296 }
1297  
1298 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1299 0 $self->_report("Already sent control file for '$jobkey'");
1300 0 return undef;
1301 }
1302  
1303 0 my $title = shift;
1304
1305 0 ▶ if (defined($title)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $title) 0 0 0
1306 0 $title =~ s/[\000-\040\200-\377]//g;
1307 0 ▶ if (length($title) < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $title < 0) 0 0 0
1308 0 $self->_report("Title too short (1 octet minimum)");
1309 0 return undef;
1310 }
1311 0 ▶ if (length($title) > 79) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $title > 79) 0 0 0
1312 0 $self->_report("Title too long (79 octet maximum)");
1313 }
1314 }
1315
1316 0 my $width = shift;
1317
1318 0 ▶ if (defined($width) && $width !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $width and not $width =~ /^\d+$/) 0 0 0
Condition0%0/3
defined $width and not $width =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $width and not $width =~ /^\d+$/
defined $width not $width =~ /^\d+$/
Truth table0%0/3
A and not(B)
A= defined $widthB= not $width =~ /^\d+$/
ABresult
0X0
100
111
1319 0 $self->_report("Width argument must be numeric");
1320 0 return undef;
1321 }
1322  
1323 0 my $job = $self->{Jobs}->{$jobkey};
1324  
1325 0 my $f = $job->{PrintFormat};
1326  
1327 0 $job->{UsedDataFileName} = 1;
1328
1329 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1330 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1331 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1332 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1333 0 delete $job->{CE}->{$f};
1334 }
1335
1336 0 $job->{PrintFormat} = 'p';
1337
1338 0 $job->{CE}->{p} = $job->{DataFileName};
1339 0 ▶ $job->{CE}->{T} = $title if (defined($title));
Branch: 1 branch
BranchTrueFalseTotal
if defined $title 0 0 0
1340 0 ▶ $job->{CE}->{W} = $width if (defined($width));
Branch: 1 branch
BranchTrueFalseTotal
if defined $width 0 0 0
1341  
1342 0 return 1;
1343 }
1344  
1345 0 ▶sub job_mode_fortran {
Subroutine job_mode_fortran: not called CC=12 SCAR=50.5
Pod undocumented
1346  
1347 0 ▶ croak 'Usage: $lp->job_mode_fortran($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1348
1349 0 my $self = shift;
1350
1351 0 my $jobkey = shift;
1352
1353 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1354 0 $self->_report("Nonexistant Job Key '$jobkey'");
1355 0 return undef;
1356 }
1357  
1358 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1359 0 $self->_report("Already sent control file for '$jobkey'");
1360 0 return undef;
1361 }
1362  
1363 0 my $job = $self->{Jobs}->{$jobkey};
1364  
1365 0 my $f = $job->{PrintFormat};
1366  
1367 0 $job->{UsedDataFileName} = 1;
1368
1369 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1370 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1371 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1372 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1373 0 delete $job->{CE}->{$f};
1374 }
1375
1376 0 $job->{PrintFormat} = 't';
1377
1378 0 $job->{CE}->{t} = $job->{DataFileName};
1379  
1380 0 return 1;
1381 }
1382  
1383 0 ▶sub job_mode_troff {
Subroutine job_mode_troff: not called CC=12 SCAR=50.5
Pod undocumented
1384  
1385 0 ▶ croak 'Usage: $lp->job_mode_troff($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1386
1387 0 my $self = shift;
1388
1389 0 my $jobkey = shift;
1390
1391 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1392 0 $self->_report("Nonexistant Job Key '$jobkey'");
1393 0 return undef;
1394 }
1395  
1396 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1397 0 $self->_report("Already sent control file for '$jobkey'");
1398 0 return undef;
1399 }
1400  
1401 0 my $job = $self->{Jobs}->{$jobkey};
1402  
1403 0 my $f = $job->{PrintFormat};
1404  
1405 0 $job->{UsedDataFileName} = 1;
1406
1407 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1408 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1409 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1410 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1411 0 delete $job->{CE}->{$f};
1412 }
1413
1414 0 $job->{PrintFormat} = 't';
1415
1416 0 $job->{CE}->{t} = $job->{DataFileName};
1417  
1418 0 return 1;
1419 }
1420  
1421 0 ▶sub job_mode_raster {
Subroutine job_mode_raster: not called CC=12 SCAR=50.5
Pod undocumented
1422  
1423 0 ▶ croak 'Usage: $lp->job_mode_raster($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1424
1425 0 my $self = shift;
1426
1427 0 my $jobkey = shift;
1428
1429 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1430 0 $self->_report("Nonexistant Job Key '$jobkey'");
1431 0 return undef;
1432 }
1433  
1434 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1435 0 $self->_report("Already sent control file for '$jobkey'");
1436 0 return undef;
1437 }
1438  
1439 0 my $job = $self->{Jobs}->{$jobkey};
1440  
1441 0 my $f = $job->{PrintFormat};
1442  
1443 0 $job->{UsedDataFileName} = 1;
1444
1445 0 ▶ if (defined($f) && length($f)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f and length $f) 0 0 0
Condition0%0/3
defined $f and length $f
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and length $f
defined $f length $f
Truth table0%0/3
A and B
A= defined $fB= length $f
ABresult
0X0
100
111
1446 0 ▶ delete $job->{CE}->{W} if ($f eq 'f' || $f eq 'l' || $f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" or $f eq "p" 0 0 0
Condition0%0/6
$f eq "f" or $f eq "l" or $f eq "p"
l!l&&r!l&&!r
000
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/3
$f eq "f" or $f eq "l" or $f eq "p"
$f eq "f" $f eq "l" $f eq "p"
Truth table0%0/4
A or B or C
A= $f eq "f"B= $f eq "l"C= $f eq "p"
ABCresult
1XX1
01X1
0011
0000
1447 0 ▶ delete $job->{CE}->{T} if ($f eq 'p');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "p" 0 0 0
1448 0 ▶ delete $job->{CE}->{I} if ($f eq 'f' || $f eq 'l');
Branch: 1 branch
BranchTrueFalseTotal
if $f eq "f" or $f eq "l" 0 0 0
Condition0%0/3
$f eq "f" or $f eq "l"
l!l&&r!l&&!r
000
MC/DC0%0/2
$f eq "f" or $f eq "l"
$f eq "f" $f eq "l"
Truth table0%0/3
A or B
A= $f eq "f"B= $f eq "l"
ABresult
1X1
011
000
1449 0 delete $job->{CE}->{$f};
1450 }
1451
1452 0 $job->{PrintFormat} = 'v';
1453
1454 0 $job->{CE}->{v} = $job->{DataFileName};
1455  
1456 0 return 1;
1457 }
1458  
1459 0 ▶sub job_send_control_file {
Subroutine job_send_control_file: not called CC=15 SCAR=54.8
Pod documented
1460  
1461 0 ▶ croak 'Usage: $lp->job_send_control_file($jobkey)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1462  
1463 0 my $self = shift;
1464
1465 0 my $jobkey = shift;
1466
1467 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1468 0 $self->_report("Nonexistant Job Key '$jobkey'");
1469 0 return undef;
1470 }
1471  
1472 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentControl"}) 0 0 0
1473 0 $self->_report("Already sent control file for '$jobkey'");
1474 0 return undef;
1475 }
1476  
1477 0 ▶ unless ($self->{Mode} == 2) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"Mode"} == 2) 0 0 0
1478 0 $self->_report("Not in JOB command mode");
1479 0 return undef;
1480 }
1481  
1482 0 my $cf = "";
1483
1484 0 my $k;
1485  
1486 my $result;
1487
1488 0 for $k (qw(C H I J M N P S T U W L 1 2 3 4 c d f g k l n o p r t v z)) {
1489 0 ▶ next unless (exists($self->{Jobs}->{$jobkey}->{CE}->{$k}));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"Jobs"}{$jobkey}{"CE"}{$k} 0 0 0
1490 0 $cf .= $k . $self->{Jobs}->{$jobkey}->{CE}->{$k} . "\n";
1491 }
1492  
1493 0 ▶ $self->{Socket}->print("\002".length($cf)." ".$self->{Jobs}->{$jobkey}->{ControlFileName}."\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cB" . length($cf) . ' ' . $self->{"Jobs"}{$jobkey}{"ControlFileName"} . "\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
1494 0 $self->_report("Error sending command ($!)");
1495 0 return undef;
1496 };
1497
1498 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
1499 0 $self->_report("Error flushing buffer ($!)");
1500 0 return undef;
1501 };
1502  
1503 0 $result = $self->{Socket}->getc();
1504
1505 0 ▶ if (length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $result) { } 0 0 0
1506 0 $result = unpack("C", $result);
1507 } else {
1508 0 $self->_report("Error getting result ($!)");
1509 0 return undef;
1510 };
1511
1512 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
1513 0 $self->_report("Printer reported an error ($result)");
1514 0 return undef;
1515 }
1516  
1517 0 ▶ $self->{Socket}->print("$cf\000") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("$cf\000") or do { $self->_report("Error sending control file ($!)"); return undef } 0 0 0
1518 0 $self->_report("Error sending control file ($!)");
1519 0 return undef;
1520 };
1521
1522 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
1523 0 $self->_report("Error flushing buffer ($!)");
1524 0 return undef;
1525 };
1526  
1527 0 $result = $self->{Socket}->getc();
1528
1529 0 ▶ if (length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $result) { } 0 0 0
1530 0 $result = unpack("C", $result);
1531 } else {
1532 0 $self->_report("Error getting result ($!)");
1533 0 return undef;
1534 };
1535
1536 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
1537 0 $self->_report("Printer reported an error ($result)");
1538 0 return undef;
1539 }
1540  
1541 0 $self->{Jobs}->{$jobkey}->{SentControl} = 1;
1542 }
1543  
1544 0 ▶sub job_send_data {
Subroutine job_send_data: not called CC=32 SCAR=69.6
Pod documented
1545  
1546 0 ▶ croak 'Usage: $lp->job_send_data($jobkey, $data [, $totalsize])' unless (@_ >= 1);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ >= 1 0 0 0
1547
1548 0 my $self = shift;
1549
1550 0 ▶ if ($self->{Mode} == 2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'Mode'} == 2) { } 0 0 0
elsif ($self->{'Mode'} == 3) { } 0 0 0
1551 0 ▶ croak 'JOB Mode Usage: $lp->job_send_data($jobkey, $data [, $totalsize])' unless (@_ >= 2 && @_ <= 3);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ >= 2 and @_ <= 3 0 0 0
Condition0%0/3
@_ >= 2 and @_ <= 3
!ll&&!rl&&r
000
MC/DC0%0/2
@_ >= 2 and @_ <= 3
@_ >= 2 @_ <= 3
Truth table0%0/3
A and B
A= @_ >= 2B= @_ <= 3
ABresult
0X0
100
111
1552 } elsif ($self->{Mode} == 3) {
1553 0 ▶ croak 'DATA Mode Usage: $lp->job_send_data($jobkey, $data)' unless (@_ == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
1554 } else {
1555 0 $self->_report("Not in JOB or DATA command mode");
1556 }
1557
1558 0 my $jobkey = shift;
1559
1560 0 ▶ unless (exists($self->{Jobs}->{$jobkey})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Jobs"}{$jobkey}) 0 0 0
1561 0 $self->_report("Nonexistant Job Key '$jobkey'");
1562 0 return undef;
1563 }
1564  
1565 0 ▶ if ($self->{Jobs}->{$jobkey}->{SentData}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Jobs"}{$jobkey}{"SentData"}) 0 0 0
1566 0 $self->_report("Already sent data file for '$jobkey'");
1567 0 return undef;
1568 }
1569
1570 0 my $data = shift;
1571  
1572 0 my $totalsize = shift;
1573  
1574 0 ▶ if (defined($totalsize) && $totalsize !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $totalsize and not $totalsize =~ /^\d+$/) 0 0 0
Condition0%0/3
defined $totalsize and not $totalsize =~ /^\d+$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $totalsize and not $totalsize =~ /^\d+$/
defined $totalsize not $totalsize =~ /^\d+$/
Truth table0%0/3
A and not(B)
A= defined $totalsizeB= not $totalsize =~ /^\d+$/
ABresult
0X0
100
111
1575 0 $self->_report("Size argument must be numeric");
1576 0 return undef;
1577 }
1578  
1579 0 ▶ if ($self->{Mode} == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Mode"} == 2) 0 0 0
1580  
1581 0 ▶ if (defined($totalsize)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $totalsize) { } 0 0 0
1582 0 ▶ $self->{Socket}->print("\003$totalsize ".$self->{Jobs}->{$jobkey}->{DataFileName}."\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cC$totalsize " . $self->{"Jobs"}{$jobkey}{"DataFileName"} . "\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
1583 0 $self->_report("Error sending command ($!)");
1584 0 return undef;
1585 };
1586 } else {
1587 0 ▶ $self->{Socket}->print("\003 ".$self->{Jobs}->{$jobkey}->{DataFileName}."\n") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\cC " . $self->{"Jobs"}{$jobkey}{"DataFileName"} . "\n") or do { $self->_report("Error sending command ($!)"); return undef } 0 0 0
1588 0 $self->_report("Error sending command ($!)");
1589 0 return undef;
1590 };
1591 }
1592  
1593 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
1594 0 $self->_report("Error flushing buffer ($!)");
1595 0 return undef;
1596 };
1597  
1598 0 my $result;
1599  
1600 0 $result = $self->{Socket}->getc();
1601  
1602 0 ▶ if (defined($result) && length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $result and length $result) { } 0 0 0
Condition0%0/3
defined $result and length $result
!ll&&!rl&&r
000
MC/DC0%0/2
defined $result and length $result
defined $result length $result
Truth table0%0/3
A and B
A= defined $resultB= length $result
ABresult
0X0
100
111
1603 0 $result = unpack("C", $result);
1604 } else {
1605 0 $self->_report("Error getting result ($!)");
1606 0 return undef;
1607 };
1608  
1609 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
1610 0 $self->_report("Printer reported an error ($result)");
1611 0 return undef;
1612 }
1613  
1614 0 ▶ $self->{Jobs}->{$jobkey}->{DataSize} = $totalsize if (defined($totalsize));
Branch: 1 branch
BranchTrueFalseTotal
if defined $totalsize 0 0 0
1615 0 $self->{Mode} = 3;
1616 0 $self->{Jobs}->{$jobkey}->{UsedDataFileName} = 1;
1617 }
1618
1619 0 ▶ if ($self->{Mode} != 3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Mode"} != 3) 0 0 0
1620 0 $self->_report("Can't send data in this mode");
1621 0 return undef;
1622 }
1623
1624 0 my $job = $self->{Jobs}->{$jobkey};
1625  
1626 0 my $dsize = length($data);
1627  
1628 0 ▶ if ($job->{DataSize} > 0 && $dsize + $job->{DataSent} > $job->{DataSize}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"DataSize"} > 0 and $dsize + $job->{"DataSent"} > $job->{"DataSize"}) 0 0 0
Condition0%0/3
$job->{"DataSize"} > 0 and $dsize + $job->{"DataSent"} > $job->{"DataSize"}
!ll&&!rl&&r
000
MC/DC0%0/2
$job->{"DataSize"} > 0 and $dsize + $job->{"DataSent"} > $job->{"DataSize"}
$job->{"DataSize"} > 0 $dsize + $job->{"DataSent"} > $job->{"DataSize"}
Truth table0%0/3
A and B
A= $job->{"DataSize"} > 0B= $dsize + $job->{"DataSent"} > $job->{"DataSize"}
ABresult
0X0
100
111
1629 0 $data = substr($data, 0, $job->{DataSize} - $job->{DataSent});
1630 }
1631
1632 0 ▶ if (length($data) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $data > 0) 0 0 0
1633 0 ▶ $self->{Socket}->print($data) or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print($data) or do { $self->_report("Error sending data ($!)"); return undef } 0 0 0
1634 0 $self->_report("Error sending data ($!)");
1635 0 return undef;
1636 };
1637 }
1638
1639 0 $job->{DataSent} += length($data);
1640
1641 0 ▶ if ($job->{DataSent} >= $job->{DataSize}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"DataSent"} >= $job->{"DataSize"}) 0 0 0
1642  
1643 0 $job->{SentData} = 1;
1644  
1645 0 ▶ if ($job->{SentControl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"SentControl"}) 0 0 0
1646 0 delete $self->{Jobs}->{$jobkey};
1647 }
1648
1649 0 ▶ $self->{Socket}->print("\000") or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->print("\0") or do { $self->_report("Error sending data ($!)"); return undef } 0 0 0
1650 0 $self->_report("Error sending data ($!)");
1651 0 return undef;
1652 };
1653
1654 0 ▶ $self->{Socket}->flush() or do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Socket"}->flush or do { $self->_report("Error flushing buffer ($!)"); return undef } 0 0 0
1655 0 $self->_report("Error flushing buffer ($!)");
1656 0 return undef;
1657 };
1658  
1659 0 my $result;
1660  
1661 0 $result = $self->{Socket}->getc();
1662  
1663 0 ▶ if (length($result)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $result) { } 0 0 0
1664 0 $result = unpack("C", $result);
1665 } else {
1666 0 $self->_report("Error getting result ($!)");
1667 0 return undef;
1668 };
1669  
1670 0 ▶ if ($result != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result != 0) 0 0 0
1671 0 $self->_report("Printer reported an error ($result)");
1672 0 return undef;
1673 }
1674 }
1675
1676 0 ▶ if ($dsize != length($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dsize != length $data) 0 0 0
1677 0 $self->_report("Data overflow error");
1678 0 return undef;
1679 }
1680
1681 0 return 1;
1682 }
1683  
1684 1 1;
↑ Summary