summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/O.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-10 21:56:14 +0000
committerKarl Berry <karl@freefriends.org>2019-03-10 21:56:14 +0000
commite0a2a718e89f9700d627f1e6a8eea8f21d2fbeb8 (patch)
tree39972f65008b0d70f306a5f976494d29411bc41e /Master/tlpkg/tlperl/lib/O.pm
parentb206fdc77d81ed1600949062f08de5690a4bf66f (diff)
tl19 perl 5.28.1 for Windows, from Siep
git-svn-id: svn://tug.org/texlive/trunk@50322 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/O.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/O.pm28
1 files changed, 15 insertions, 13 deletions
diff --git a/Master/tlpkg/tlperl/lib/O.pm b/Master/tlpkg/tlperl/lib/O.pm
index 2976a894208..81c879835bc 100644
--- a/Master/tlpkg/tlperl/lib/O.pm
+++ b/Master/tlpkg/tlperl/lib/O.pm
@@ -1,16 +1,18 @@
package O;
-our $VERSION = '1.01';
+our $VERSION = '1.03';
-use B qw(minus_c save_BEGINs);
-use Carp;
+use B ();
+
+our $BEGIN_output;
+our $saveout_fh;
sub import {
my ($class, @options) = @_;
my ($quiet, $veryquiet) = (0, 0);
if ($options[0] eq '-q' || $options[0] eq '-qq') {
$quiet = 1;
- open (SAVEOUT, ">&STDOUT");
+ open ($saveout_fh, ">&", STDOUT);
close STDOUT;
open (STDOUT, ">", \$O::BEGIN_output);
if ($options[0] eq '-qq') {
@@ -21,15 +23,15 @@ sub import {
my $backend = shift (@options);
eval q[
BEGIN {
- minus_c;
- save_BEGINs;
+ B::minus_c;
+ B::save_BEGINs;
}
CHECK {
if ($quiet) {
close STDOUT;
- open (STDOUT, ">&SAVEOUT");
- close SAVEOUT;
+ open (STDOUT, ">&", $saveout_fh);
+ close $saveout_fh;
}
# Note: if you change the code after this 'use', please
@@ -37,10 +39,6 @@ sub import {
# "fragile kludge") so that its output still looks
# nice. Thanks. --smcc
use B::].$backend.q[ ();
- if ($@) {
- croak "use of backend $backend failed: $@";
- }
-
my $compilesub = &{"B::${backend}::compile"}(@options);
if (ref($compilesub) ne "CODE") {
@@ -54,7 +52,11 @@ sub import {
close STDERR if $veryquiet;
}
];
- die $@ if $@;
+ if ($@) {
+ my $msg = "$@";
+ require Carp;
+ Carp::croak("Loading compiler backend 'B::$backend' failed: $msg");
+ }
}
1;