1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Safely check eval blocks and convert $@ to $EVAL_ERROR.

This commit is contained in:
David Steele
2016-09-06 09:44:50 -04:00
parent a701309453
commit dd8d781217
60 changed files with 1195 additions and 790 deletions

View File

@@ -6,6 +6,7 @@ package BackRestDoc::Latex::DocLatex;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use English '-no_match_vars';
use Data::Dumper;
use Exporter qw(import);
@@ -13,10 +14,10 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use File::Copy;
use POSIX qw(strftime);
use Scalar::Util qw(blessed);
use Storable qw(dclone);
use lib dirname($0) . '/../lib';
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::FileCommon;
@@ -112,14 +113,14 @@ sub process
# Save the html page
$strLatex .= $oDocLatexSection->process();
};
if ($@)
return true;
}
or do
{
my $oMessage = $@;
my $oException = $EVAL_ERROR;
# If a backrest exception then return the code - don't confess
if (blessed($oMessage) && $oMessage->isa('pgBackRest::Common::Exception') && $oMessage->code() == -1)
if (isException($oException) && $oException->code() == ERROR_FILE_INVALID)
{
my $oRenderOut = $self->{oManifest}->renderOutGet(RENDER_TYPE_HTML, $strPageId);
$self->{oManifest}->cacheReset($$oRenderOut{source});
@@ -130,7 +131,7 @@ sub process
# Save the html page
$strLatex .= $oDocLatexSection->process();
}
}
};
}
$strLatex .= "\n% " . ('-' x 130) . "\n% End document\n% " . ('-' x 130) . "\n\\end{document}\n";

View File

@@ -8,14 +8,9 @@ use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use Data::Dumper;
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use File::Copy;
use Storable qw(dclone);
use lib dirname($0) . '/../lib';
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;