TeX-AutoTeX
view release on metacpan or search on metacpan
lib/TeX/AutoTeX/File.pm view on Meta::CPAN
my $log = $self->{fileset}->{log};
my $dir = $self->{fileset}->{dir};
my $file = $self->{filename};
my $dvi_flags = $process->{branch} =~ m{texlive/}? '-R2' : '-R';
$dvi_flags .= " $self->{dvi_flags}" if $self->{dvi_flags};
$dvi_flags .= ' -t landscape' if $self->{flags}->{landscape};
$dvi_flags .= $self->{flags}->{keepcomments}? ' -K0' : ' -K1';
my $response;
my $setenv = qq{export HOME=/tmp @{[$ENV{TEXMFCNF}? "TEXMFCNF=$ENV{TEXMFCNF}": q{}]} PATH=$process->{tex_env_path}};
my $crdir = substr $dir, length $TEX_PATH;
while (1) {
$log->verbose(" ~~~~~~~~~~~ Processing file '$file'");
my $dvipscommand = qq#$TEXCHR $TEX_PATH "($setenv; cd $crdir && $DVIPS $dvi_flags -z '$file' -o )" 2>&1#;
$log->verbose('Running: ' . substr $dvipscommand, length "$TEXCHR $TEX_PATH ");
my $dvipstime = time;
$response = `$dvipscommand`;
last if !$?;
$log->verbose("$DVIPS $dvi_flags -z produced an error: $?\nResponse was $response\nRetrying without '-z'");
if (-e "$dir/head.tmp" && -e "$dir/body.tmp") {
unlink "$dir/head.tmp", "$dir/body.tmp";
$log->verbose('removed dvips leftover head.tmp and body.tmp');
}
# dvips -z may have core-dumped. remove only newly generated core file(s)
if (my @corefiles = glob "$dir/core\.[0-9]*") {
@corefiles =
map { m/(.*)/ }
grep { m{^$dir/core\.\d+$} && (stat "$dir/$_")[9] >= $dvipstime }
@corefiles;
if (@corefiles) {
unlink @corefiles;
$log->verbose("removed one or more core files: @corefiles");
}
}
$dvipscommand = qq#$TEXCHR $TEX_PATH "($setenv; cd $crdir && $DVIPS $dvi_flags '$file' -o )" 2>&1#;
$log->verbose('Running: ' . substr $dvipscommand, length "$TEXCHR $TEX_PATH ");
$response = `$dvipscommand`;
last if !$?;
$log->verbose("$DVIPS $dvi_flags produced an error: $?\nResponse was $response.");
$log->error('Failed to produce postscript from dvi.');
}
$log->verbose("dvi(h)ps said ...\n$response.");
my %commondvipsheaders;
@commondvipsheaders{qw(
lib/TeX/AutoTeX/File.pm view on Meta::CPAN
$escaped_tex_format = q{&} . $tex_format;
# escape (&) in $tex_format and remove double quotes
# TS: where would those come from after the lookup table replaced older code?
$escaped_tex_format =~ s/&/\\\&/g;
$escaped_tex_format =~ s/"//g; # "
} else {
$log->verbose("'$tex_format' is not a valid TeX format; will ignore.");
}
}
my $setenv = qq{export HOME=/tmp @{[$ENV{TEXMFCNF}? "TEXMFCNF=$ENV{TEXMFCNF}": q{}]} PATH=$process->{tex_env_path}};
$log->verbose(qq{TEXMFCNF is @{[$ENV{TEXMFCNF}? "set to: '$ENV{TEXMFCNF}'": 'unset.']}});
my $crdir = substr $self->{fileset}->{dir}, length $TEX_PATH;
my $runtexcommand = qq#$TEXCHR $TEX_PATH "($setenv; cd $crdir && $program $escaped_tex_format '$self->{filename}' < $feeder)" 2>&1#;
my $passes = 0;
my $rerun = 0;
my $extra_pass = 0;
my $xfontcreate = 0;
my $lastlog_ref;
my $failed;
my @ORDER = qw(first second third fourth fifth sixth seventh);
( run in 0.331 second using v1.01-cache-2.11-cpan-a1d94b6210f )