AutoTeX/Process.pm

filter: Statementstmt 7.8% 17 / 216 Branchbran 0.0% 0 / 90 Conditioncond 0.0% 0 / 39 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 25.0% 5 / 20 Podpod 100% 14 / 14 totaltotal 8.9% 36 / 403 CC 65 SCAR 64.8
CC
65
Cov
5%
process_files
1406.0
parse_readme
182.0
new
42.0
CRAP 654.0
« AutoTeX/File.pm ↑ Summary AutoTeX/PostScript.pm »
1 package TeX::AutoTeX::Process;
2  
3 #
4 # $Id: Process.pm,v 1.14.2.7 2011/02/03 03:57:38 thorstens Exp $
5 # $Revision: 1.14.2.7 $
6 # $Source: /cvsroot/arxivlib/arXivLib/lib/TeX/AutoTeX/Process.pm,v $
7 #
8 # $Date: 2011/02/03 03:57:38 $
9 # $Author: thorstens $
10 #
11  
12 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 ### use warnings;
14 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 our ($VERSION) = '$Revision: 1.14.2.7 $' =~ m{ \$Revision: \s+ (\S+) }x;
17  
18 2 ▶use TeX::AutoTeX::Config qw($AUTOTEX_TIMEOUT $DIRECTIVE_FILE);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use TeX::AutoTeX::Fileset;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use TeX::AutoTeX::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
Pod documented
23 0 my $class = shift;
24 0 my $self = {
25 log => undef,
26 fileset => undef,
27 stampref => [],
28 use_stamp => 1,
29 hlink_stamp => 1,
30 temp_dir => undef,
31 branch => undef,
32 dvi_flags => [],
33 made_pdf => [],
34 nohypertex => undef,
35 warnings => {},
36 decryption_key => undef,
37 tex_env_path => undef,
38 @_
39 };
40  
41 # Sanity checks...
42 0 ▶ croak 'No log configuration supplied.' unless defined $self->{log};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"log"} 0 0 0
43 croak 'Missing site configuration.'
44 unless (defined $self->{temp_dir}
45 and defined $self->{branch}
46 0 ▶ and defined $self->{tex_env_path});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"temp_dir"} and defined $self->{"branch"} and defined $self->{"tex_env_path"} 0 0 0
Condition0%0/6
defined $self->{"temp_dir"} and defined $self->{"branch"} and defined $self->{"tex_env_path"}
!ll&&!rl&&r
000
defined $self->{"temp_dir"} and defined $self->{"branch"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->{"temp_dir"} and defined $self->{"branch"} and defined $self->{"tex_env_path"}
defined $self->{"temp_dir"} defined $self->{"branch"} defined $self->{"tex_env_path"}
Truth table0%0/4
A and B and C
A= defined $self->{"temp_dir"}B= defined $self->{"branch"}C= defined $self->{"tex_env_path"}
ABCresult
0XX0
10X0
1100
1111
47 0 ▶ if (!$self->{fileset}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"fileset"}) 0 0 0
48 $self->{fileset} = TeX::AutoTeX::Fileset->new(
49 log => $self->{log},
50 dir => $self->{temp_dir},
51 0 );
52 }
53 0 bless $self, $class;
54 0 return $self;
55 }
56  
57 0 ▶sub go {
Subroutine go: not called CC=2 SCAR=17.9
Pod documented
58 0 my $self = shift;
59  
60 eval {
61 0 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; #make %ENV safer, see camel
62 0 ▶ local $SIG{ALRM} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 0 croak "AutoTeX process timed out after ${AUTOTEX_TIMEOUT}s (" . localtime(), q{)};
64 0 };
65 0 alarm $AUTOTEX_TIMEOUT;
66 0 umask oct 2;
67 0 setpgrp;
68 0 $self->process_files();
69 0 alarm 0; # Cancel the alarm if process_files() returns before $AUTOTEX_TIMEOUT
70 0 1;
71 0 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { delete @ENV{"IFS", "CDPATH", "ENV", "BASH_ENV"}; local $SIG{"ALRM"} = sub { croak("AutoTeX process timed out after $TeX::AutoTeX::Process::AUTOTEX_TIMEOUTs (" . (localtime()), ")"); } ; alarm $TeX::AutoTeX::Process::AUTOTEX_TIMEOUT; umask 02; setpgrp; $self->process_files; alarm 0; 1 } } or do { local $SIG{"TERM"} = "IGNORE"; kill "TERM", -$$ } 0 0 0
72 0 local $SIG{TERM} = 'IGNORE';
73 0 kill TERM => -$$;
74 };
75 0 alarm 0; # Cancel the alarm if process_files() died.
76 0 return $@; # true on eval error
77 }
78  
79 0 ▶sub process_files {
Subroutine process_files: not called CC=37 SCAR=72.5
Pod documented
80 0 my $self = shift;
81  
82 0 $self->clean_times();
83 0 $self->parse_readme();
84 0 $self->process_of_type('TYPE_ENCRYPTED');
85 0 my $log = $self->{log};
86 0 my $tmpdir = $self->{temp_dir};
87 # list files, and build a hash of tex files and assign processing priorities
88 0 my $highest_pri = 0;
89 0 my %priority_value; # stores priority values of all tex-type files
90 0 my @unknowns = (); # names of files with unknown types
91 0 foreach my $fileobj ($self->file_list()) {
92 0 my $filename = $fileobj->{filename};
93 0 my $filetype = $fileobj->filetype_name();
94 0 ▶ if ( $filetype =~ /(compressed|TAR\sarchive|MULTI_PART_MIME|UUencoded)/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filetype =~ /(compressed|TAR\sarchive|MULTI_PART_MIME|UUencoded)/i) 0 0 0
95 0 $log->error("Package contains '$filename' which is of type '$filetype'. This file should be removed or marked ignore.");
96 0 exit 121;
97 }
98 0 ▶ next if ( -d "$tmpdir/$filename" #TS there shouldn't be any directories in self->file_list()
Branch: 1 branch
BranchTrueFalseTotal
if -d "$tmpdir/$filename" or $filename eq "." or $filename eq ".." 0 0 0
Condition0%0/6
-d "$tmpdir/$filename" or $filename eq "." or $filename eq ".."
l!l&&r!l&&!r
000
-d "$tmpdir/$filename" or $filename eq "."
l!l&&r!l&&!r
000
MC/DC0%0/3
-d "$tmpdir/$filename" or $filename eq "." or $filename eq ".."
-d "$tmpdir/$filename" $filename eq "." $filename eq ".."
Truth table0%0/4
A or B or C
A= -d "$tmpdir/$filename"B= $filename eq "."C= $filename eq ".."
ABCresult
1XX1
01X1
0011
0000
99 || $filename eq q{.} # shouldn't happen
100 || $filename eq q{..} # shouldn't happen
101 );
102 0 ▶ unless ($filename =~ /auto_gen(?:_ps)?\.log/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($filename =~ /auto_gen(?:_ps)?\.log/) 0 0 0
103 0 $log->verbose(" <$filename>\t is of type '$filetype'.");
104 0 ▶ if ($filetype eq 'unknown'){
Branch: 1 branch
BranchTrueFalseTotal
if ($filetype eq "unknown") 0 0 0
105 0 push @unknowns, $filename;
106 }
107 }
108 0 $priority_value{$filename} = $fileobj->assign_tex_priority();
109 0 ▶ if ($priority_value{$filename} > $highest_pri) {
Branch: 1 branch
BranchTrueFalseTotal
if ($priority_value{$filename} > $highest_pri) 0 0 0
110 0 $highest_pri = $priority_value{$filename};
111 }
112 }
113  
114 0 my %process_fail_time = (); # times of attempted processing of failures
115 0 ▶ unless ($highest_pri) {
Branch: 1 branch
BranchTrueFalseTotal
if ($highest_pri) { } 0 0 0
116 0 $log->verbose('No tex files present, going to hope we can process as a postscript or dvi only package.');
117 } else {
118 # We go through the list of files sorted by priorities in reverse and
119 # lexicographic order (as of perl 5.6 sort is stable, so two succeeding
120 # sorts retain order) attempting to process them until successful.
121 my @fileobjects =
122 0 sort {$priority_value{$b->{filename}} <=> $priority_value{$a->{filename}}}
123 0 sort {$a->{filename} cmp $b->{filename}}
124 0 grep {$priority_value{$_->{filename}} > 0}
125 $self->file_list(); #TS: note that this re-scans cwd
126 0 my $successful = 0;
127 0 my $start = time;
128 0 foreach my $fileobj (@fileobjects) {
129 0 my $filename = $fileobj->{filename};
130 0 ▶ if (! -e "$tmpdir/$filename") {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e "$tmpdir/$filename") 0 0 0
131 0 $log->verbose("'$filename' already used and removed, no longer in the processing queue.");
132 0 next;
133 }
134 0 ▶ if (!$successful || (stat "$tmpdir/$filename")[8] < $start) { #atime
Branch: 1 branch
BranchTrueFalseTotal
if (not $successful or (stat "$tmpdir/$filename")[8] < $start) 0 0 0
Condition0%0/3
not $successful or (stat "$tmpdir/$filename")[8] < $start
l!l&&r!l&&!r
000
MC/DC0%0/2
not $successful or (stat "$tmpdir/$filename")[8] < $start
not $successful (stat "$tmpdir/$filename")[8] < $start
Truth table0%0/3
not(A) or B
A= not $successfulB= (stat "$tmpdir/$filename")[8] < $start
ABresult
1X1
011
000
135 0 $log->verbose(" ~~~~~~~~~~~ Processing file '$filename'");
136 0 ▶ if ($fileobj->process($self)){ # returns true if unsuccessful
Branch: 1 branch
BranchTrueFalseTotal
if ($fileobj->process($self)) { } 0 0 0
137 0 $process_fail_time{$filename} = time;
138 } else { # processing was successful
139 0 ▶ if ($self->{branch} eq '3' || $self->{branch} =~ m{texlive/}) { # check for generated PDF
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"branch"} eq 3 or $self->{"branch"} =~ m[texlive/]) 0 0 0
Condition0%0/3
$self->{"branch"} eq 3 or $self->{"branch"} =~ m[texlive/]
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"branch"} eq 3 or $self->{"branch"} =~ m[texlive/]
$self->{"branch"} eq 3 $self->{"branch"} =~ m[texlive/]
Truth table0%0/3
A or B
A= $self->{"branch"} eq 3B= $self->{"branch"} =~ m[texlive/]
ABresult
1X1
011
000
140 0 (my $pdffile = $filename) =~ s/(?:\.[^.]*)?$/.pdf/; #TS: note pathologic case "^.something$"
141 0 ▶ if (-s "$tmpdir/$pdffile" && (stat(_))[9] >= $start) { # mtime
Branch: 1 branch
BranchTrueFalseTotal
if (-s "$tmpdir/$pdffile" and (stat _)[9] >= $start) 0 0 0
Condition0%0/3
-s "$tmpdir/$pdffile" and (stat _)[9] >= $start
!ll&&!rl&&r
000
MC/DC0%0/2
-s "$tmpdir/$pdffile" and (stat _)[9] >= $start
-s "$tmpdir/$pdffile" (stat _)[9] >= $start
Truth table0%0/3
A and B
A= -s "$tmpdir/$pdffile"B= (stat _)[9] >= $start
ABresult
0X0
100
111
142 0 push @{$self->{made_pdf}}, $pdffile;
143 0 ▶ if (my $stampref = $self->get_stamp()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $stampref = $self->get_stamp) 0 0 0
144 0 $log->verbose("now stamping pdf file '$pdffile' with stamp '$stampref->[0]'");
145 0 require TeX::AutoTeX::StampPDF;
146 0 TeX::AutoTeX::StampPDF::stamp_pdf("$tmpdir/$pdffile", $stampref);
147 0 $log->verbose('stamped pdf file');
148 }
149 }
150 }
151 0 $successful++;
152 }
153 }
154  
155 0 ▶ if ( -e "$tmpdir/missfont.log" ){
Branch: 1 branch
BranchTrueFalseTotal
if (-e "$tmpdir/missfont.log") 0 0 0
156 0 $log->error('missfont.log present.');
157 0 exit 123;
158 }
159 }
160 0 ▶ if (!$successful) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $successful) { } 0 0 0
161 0 $log->error('Unable to sucessfully process tex files.');
162 0 exit 125;
163 } else {
164 0 my $junk_warning = q{};
165 0 foreach my $unknown (@unknowns) {
166 0 my $atime = (stat "$tmpdir/$unknown")[8]; # undef if no longer present
167 0 ▶ if ($atime and $atime < $start){ # file hasn't been read since start of process
Branch: 1 branch
BranchTrueFalseTotal
if ($atime and $atime < $start) 0 0 0
Condition0%0/3
$atime and $atime < $start
!ll&&!rl&&r
000
MC/DC0%0/2
$atime and $atime < $start
$atime $atime < $start
Truth table0%0/3
A and B
A= $atimeB= $atime < $start
ABresult
0X0
100
111
168 0 ▶ $junk_warning .= "<$unknown> unrecognized by FileGuess:\n"
Branch: 1 branch
BranchTrueFalseTotal
-T "$tmpdir/$unknown" ? : 0 0 0
169 . ( -T "$tmpdir/$unknown" ? `head "$tmpdir/$unknown"` : 'not an ASCII text file' )
170 . "\n--------------------------------------\n";
171 }
172 }
173 0 foreach my $filename (keys %process_fail_time){
174 0 my $atime = (stat "$tmpdir/$filename")[8];
175 0 ▶ if ($atime <= $process_fail_time{$filename}){
Branch: 1 branch
BranchTrueFalseTotal
if ($atime <= $process_fail_time{$filename}) 0 0 0
176 # file hasn't been read since failed attempt at processing it
177 # TS: note that atime = process_fail_time does not conclusively indicate anything
178 # would have to re-set atime after process failure before continuing,
179 # because second granularity is not fine enough.
180 0 ▶ $junk_warning .= "<$filename> appears to be tex-type, but was neither included nor processable:\n"
Branch: 1 branch
BranchTrueFalseTotal
-T "$tmpdir/$filename" ? : 0 0 0
181 . ( -T "$tmpdir/$filename" ? `head "$tmpdir/$filename"` : 'not an ASCII text file' )
182 . "\n--------------------------------------\n";
183 }
184 }
185 0 ▶ if ($junk_warning) {
Branch: 1 branch
BranchTrueFalseTotal
if ($junk_warning) 0 0 0
186 0 $log->verbose("Junk file warnings!\n\n--------------------------------------\n$junk_warning");
187 0 $self->{warnings}{junk_warning} = $junk_warning;
188 }
189 }
190 }
191 0 $self->process_of_type('TYPE_DVI');
192 0 ▶ if ( -e "$tmpdir/missfont.log" ){
Branch: 1 branch
BranchTrueFalseTotal
if (-e "$tmpdir/missfont.log") 0 0 0
193 0 $log->error('missfont.log present.');
194 0 exit 127;
195 }
196 0 ▶ if (@{$self->{made_pdf}} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{"made_pdf"};} > 1) 0 0 0
197 0 my $combinedfile = 'xxxpdfpages';
198 0 ▶ if (-e "$tmpdir/$combinedfile.tex" || -e "$tmpdir/$combinedfile.pdf") {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "$tmpdir/$combinedfile.tex" or -e "$tmpdir/$combinedfile.pdf") 0 0 0
Condition0%0/3
-e "$tmpdir/$combinedfile.tex" or -e "$tmpdir/$combinedfile.pdf"
l!l&&r!l&&!r
000
MC/DC0%0/2
-e "$tmpdir/$combinedfile.tex" or -e "$tmpdir/$combinedfile.pdf"
-e "$tmpdir/$combinedfile.tex" -e "$tmpdir/$combinedfile.pdf"
Truth table0%0/3
A or B
A= -e "$tmpdir/$combinedfile.tex"B= -e "$tmpdir/$combinedfile.pdf"
ABresult
1X1
011
000
199 0 $combinedfile = "xxxpdfpages_$$";
200 }
201 0 ▶ open my $PDFPAGES, '>', "$tmpdir/$combinedfile.tex" ||
Condition0%0/3
"$tmpdir/$combinedfile.tex" || $log->error("couldn't open $combinedfile.tex for writing: $!")
l!l&&r!l&&!r
000
MC/DC0%0/2
"$tmpdir/$combinedfile.tex" || $log->error("couldn't open $combinedfile.tex for writing: $!")
"$tmpdir/$combinedfile.tex" $log->error("couldn't open $combinedfile.tex for writing: $!")
Truth table0%0/3
A || B
A= "$tmpdir/$combinedfile.tex"B= $log->error("couldn't open $combinedfile.tex for writing: $!")
ABresult
1X1
011
000
202 $log->error("couldn't open $combinedfile.tex for writing: $!");
203 0 print {$PDFPAGES} "\\pdfoutput=1\n\\documentclass{article}\n\\usepackage{pdfpages}\n\\begin{document}\n",
204 0 join(q{}, map { "\\includepdf[pages=-]{$_}\n" } @{$self->{made_pdf}}),
205 "\\end{document}\n";
206 0 ▶ close $PDFPAGES || $log->verbose("error closing $combinedfile.tex: $!");
Branch: 1 branch
BranchTrueFalseTotal
close $PDFPAGES or $log->verbose("error closing $combinedfile.tex: $!") 0 0 0
207 0 $log->verbose('creating a combined PDF file out of multiple PDF documents');
208 0 $self->{made_pdf} = [];
209 0 ▶ if ($self->{fileset}->new_File("$combinedfile.tex")->process($self)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'fileset'}->new_File("$combinedfile.tex")->process($self)) { } 0 0 0
210 0 $log->error('failed to create combined PDF file.');
211 } else {
212 0 $self->{made_pdf}->[0] = "$combinedfile.pdf";
213 }
214 }
215 0 return;
216 }
217  
218 0 ▶sub clean_times {
Subroutine clean_times: not called CC=4 SCAR=30.0
Pod documented
219 0 my $self = shift;
220  
221 opendir(my $DIR, $self->{temp_dir})
222 0 ▶ || $self->{log}->error("Could not read directory '$self->{temp_dir}'.");
Branch: 1 branch
BranchTrueFalseTotal
opendir my $DIR, $self->{"temp_dir"} or $self->{"log"}->error(qq[Could not read directory '$self->{"temp_dir"}'.]) 0 0 0
223 0 my $now = time;
224 my $count = map {utime($now, $now, "$self->{temp_dir}/$_")
225 0 ▶ || $self->{log}->verbose("Couldn't touch $_: $!");}
Condition0%0/3
utime($now, $now, "$self->{'temp_dir'}/$_") || $self->{'log'}->verbose("Couldn't touch ${_}: $!")
l!l&&r!l&&!r
000
MC/DC0%0/2
utime($now, $now, "$self->{'temp_dir'}/$_") || $self->{'log'}->verbose("Couldn't touch ${_}: $!")
utime($now, $now, "$self->{'temp_dir'}/$_") $self->{'log'}->verbose("Couldn't touch ${_}: $!")
Truth table0%0/3
A || B
A= utime($now, $now, "$self->{'temp_dir'}/$_")B= $self->{'log'}->verbose("Couldn't touch ${_}: $!")
ABresult
1X1
011
000
226 0 map {m/^(.*)$/}
227 0 ▶ grep {$_ ne q{.} && $_ ne q{..}}
Condition0%0/3
$_ ne '.' && $_ ne '..'
!ll&&!rl&&r
000
MC/DC0%0/2
$_ ne '.' && $_ ne '..'
$_ ne '.' $_ ne '..'
Truth table0%0/3
A && B
A= $_ ne '.'B= $_ ne '..'
ABresult
0X0
100
111
228 readdir $DIR;
229 ### $self->{log}->verbose("Touched $count files and directories.");
230 0 closedir $DIR;
231 0 return 0;
232 }
233  
234 0 ▶sub process_of_type {
Subroutine process_of_type: not called CC=5 SCAR=34.0
Pod documented
235 0 my $self = shift;
236 0 my @types = @_;
237  
238 0 my @fileobjects = $self->file_list();
239  
240 0 foreach my $fileobj (@fileobjects) {
241 0 my $t = $fileobj->type();
242 0 foreach my $type (@types) {
243 0 ▶ if ($t eq $type) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t eq $type) 0 0 0
244 0 ▶ if ($t eq 'TYPE_DVI') {
Branch: 1 branch
BranchTrueFalseTotal
if ($t eq "TYPE_DVI") 0 0 0
245 0 $fileobj->set_dvi_flags($self->dvi_flags_tostring());
246 }
247 0 $fileobj->process($self);
248 }
249 }
250 }
251 0 return 0;
252 }
253  
254 0 ▶sub file_list {
Subroutine file_list: not called CC=2 SCAR=17.9
Pod documented
255 0 my $self = shift;
256 opendir(my $DIR, $self->{temp_dir})
257 0 ▶ || $self->{log}->error('Could not read directory.');
Branch: 1 branch
BranchTrueFalseTotal
opendir my $DIR, $self->{"temp_dir"} or $self->{"log"}->error("Could not read directory.") 0 0 0
258 0 my @fileobjects = map {$self->{fileset}->new_File($_)}
259 0 grep {-f "$self->{temp_dir}/$_"} # no (sub-)directories, symlinks, etc
260 readdir $DIR;
261 0 closedir $DIR;
262 0 return @fileobjects;
263 }
264  
265 0 ▶sub parse_readme {
Subroutine parse_readme: not called CC=13 SCAR=52.0
Pod documented
266 0 my $self = shift;
267 0 ▶ return unless -e "$self->{temp_dir}/$DIRECTIVE_FILE";
Branch: 1 branch
BranchTrueFalseTotal
unless -e qq[$self->{"temp_dir"}/$TeX::AutoTeX::Process::DIRECTIVE_FILE] 0 0 0
268 open(my $README, '<', "$self->{temp_dir}/$DIRECTIVE_FILE")
269 0 ▶ || $self->{log}->error("Couldn't open $DIRECTIVE_FILE");
Branch: 1 branch
BranchTrueFalseTotal
open my $README, "<", qq[$self->{"temp_dir"}/$TeX::AutoTeX::Process::DIRECTIVE_FILE] or $self->{"log"}->error("Couldn't open $TeX::AutoTeX::Process::DIRECTIVE_FILE") 0 0 0
270 0 ▶ while (my $line = <$README>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $README)) 0 0 0
271 0 ▶ next if $line =~ /^[#%]/; # allow shell-style and tex-style comments
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^[#%]/ 0 0 0
272 0 chomp $line;
273 0 $line =~ s/\s+$//;
274 0 $line =~ s/^\s+//;
275 0 my ($token, $type) = split /\s+/, $line, 2;
276 0 ▶ if (!defined $token) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $token) 0 0 0
277 0 $self->{log}->verbose("$DIRECTIVE_FILE PARSER: I don't get this: $line");
278 0 next;
279 }
280 0 ▶ if ($token eq 'nohypertex') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "nohypertex") 0 0 0
281 0 $self->{nohypertex} = 1;
282 0 $self->{log}->verbose('nohypertex: switching off hyperlinks');
283 0 next;
284 }
285 0 ▶ if ($token eq 'nostamp') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "nostamp") 0 0 0
286 0 $self->{use_stamp} = 0;
287 0 $self->{log}->verbose('nostamp: will not stamp PostScript or PDF');
288 0 next;
289 }
290 0 ▶ if (!defined $type) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $type) 0 0 0
291 0 $self->{log}->verbose("$DIRECTIVE_FILE PARSER: I don't get this: '$line'");
292 0 next;
293 }
294  
295 0 my $file = $self->{fileset}->new_File($token);
296  
297 0 my %flagtypes = (
298 landscape => "landscape: will use landscape mode for '$token'\n",
299 keepcomments => "dvips flag '-K0' will be used for '$token'\n",
300 toplevelfile => "toplevelfile: will use '$token' as parent\n" ,
301 );
302  
303  
304 0 ▶ if (my $message = $flagtypes{$type}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $message = $flagtypes{$type}) 0 0 0
305 0 $file->set_flag($type);
306 0 $self->{log}->verbose($message);
307 0 next;
308 }
309  
310 0 ▶ if ($type eq 'fontmap') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "fontmap") 0 0 0
311 0 ▶ if ($token =~ /^\+?([a-z]+\.map)$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token =~ /^\+?([a-z]+\.map)$/i) 0 0 0
312 0 $self->add_dvi_flag("-u +./$1");
313 0 $self->{log}->verbose("dvips flag '-u +./$1' will be used");
314 }
315 0 $file->type_override('include');
316 0 next;
317 }
318 # if type didn't trigger any other action
319 0 $file->type_override($type);
320 }
321 0 ▶ close($README) || $self->{log}->verbose("warning: couldn't close directive file: $!");
Branch: 1 branch
BranchTrueFalseTotal
close $README or $self->{"log"}->verbose("warning: couldn't close directive file: $!") 0 0 0
322 0 return;
323 }
324  
325 0 ▶sub set_dvi_flags {
Subroutine set_dvi_flags: not called CC=1 SCAR=6.9
Pod documented
326 0 my $self = shift;
327 0 @{$self->{dvi_flags}} = @_;
328 }
329  
330 0 ▶sub dvi_flags_tostring {
Subroutine dvi_flags_tostring: not called CC=1 SCAR=6.9
Pod documented
331 0 my $self = shift;
332 0 return join q{ }, @{$self->{dvi_flags}};
333 }
334  
335 0 ▶sub add_dvi_flag {
Subroutine add_dvi_flag: not called CC=2 SCAR=17.9
Pod documented
336 0 my $self = shift;
337 0 ▶ my $argstring = shift || carp 'no arguments provided to add_dvi_flag()';
Condition0%0/3
shift() || carp('no arguments provided to add_dvi_flag()')
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || carp('no arguments provided to add_dvi_flag()')
shift() carp('no arguments provided to add_dvi_flag()')
Truth table0%0/3
A || B
A= shift()B= carp('no arguments provided to add_dvi_flag()')
ABresult
1X1
011
000
338 0 push @{$self->{dvi_flags}}, $argstring;
339 }
340  
341 0 ▶sub set_use_stamp {
Subroutine set_use_stamp: not called CC=1 SCAR=6.9
Pod documented
342 0 my $self = shift;
343 0 $self->{use_stamp} = shift;
344 }
345  
346 0 ▶sub toggle_hlink_stamp {
Subroutine toggle_hlink_stamp: not called CC=1 SCAR=6.9
Pod documented
347 0 my $self = shift;
348 0 $self->{hlink_stamp} = 1^$self->{hlink_stamp};
349 }
350  
351 0 ▶sub get_stamp {
Subroutine get_stamp: not called CC=2 SCAR=17.9
Pod documented
352 0 my $self = shift;
353 0 ▶ if ($self->{use_stamp}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"use_stamp"}) 0 0 0
354 0 return $self->{stampref};
355 }
356 0 return;
357 }
358  
359 0 ▶sub get_warning {
Subroutine get_warning: not called CC=1 SCAR=6.9
Pod documented
360 0 my ($self, $type) = @_;
361 0 return($self->{warnings}{$type});
362 }
363  
364 2 1;
365  
366 __END__
« AutoTeX/File.pm ↑ Summary AutoTeX/PostScript.pm »