Revert "tools: Use Carp"

This reverts commit f207b00b05.

None of these warn/die messages request a stack dump since they all
end with \n, but carp & croak ignore that.
This commit is contained in:
Andrew Johnson
2018-01-19 11:06:23 -06:00
parent 66c6aaa44f
commit 0315e90e6e
2 changed files with 10 additions and 14 deletions
+6 -8
View File
@@ -5,8 +5,6 @@
# in file LICENSE that is included with this distribution.
#*************************************************************************
use Carp;
# Copy directories and files from a template
sub copyTree {
@@ -15,7 +13,7 @@ sub copyTree {
# $Rtextsubs contains substitutions for file content.
opendir my $FILES, $src
or croak "opendir failed while copying $src: $!\n";
or die "opendir failed while copying $src: $!\n";
my @entries = readdir $FILES;
closedir $FILES;
@@ -36,9 +34,9 @@ sub copyTree {
print "." unless $opt_d;
copyFile($srcName, $dstName, $Rtextsubs);
} elsif (-l $srcName) {
carp "\nSoft link in template, ignored:\n\t$srcName\n";
warn "\nSoft link in template, ignored:\n\t$srcName\n";
} else {
carp "\nUnknown file type in template, ignored:\n\t$srcName\n";
warn "\nUnknown file type in template, ignored:\n\t$srcName\n";
}
}
}
@@ -46,11 +44,11 @@ sub copyTree {
sub copyDir {
my ($src, $dst, $Rnamesubs, $Rtextsubs) = @_;
if (-e $dst && ! -d $dst) {
carp "\nTarget exists but is not a directory, skipping:\n\t$dst\n";
warn "\nTarget exists but is not a directory, skipping:\n\t$dst\n";
return;
}
print "Creating directory '$dst'\n" if $opt_d;
mkdir $dst, 0777 or croak "Can't create $dst: $!\n"
mkdir $dst, 0777 or die "Can't create $dst: $!\n"
unless -d $dst;
copyTree($src, $dst, $Rnamesubs, $Rtextsubs);
}
@@ -61,7 +59,7 @@ sub copyFile {
print "Creating file '$dst'\n" if $opt_d;
open(my $SRC, '<', $src)
and open(my $DST, '>', $dst)
or croak "$! copying $src to $dst\n";
or die "$! copying $src to $dst\n";
while (<$SRC>) {
# Substitute any @VARS@ in the text
s{@(\w+?)@}
+4 -6
View File
@@ -5,8 +5,6 @@
# in file LICENSE that is included with this distribution.
#*************************************************************************
use Carp;
#
# Parse all relevent configure/RELEASE* files and includes
#
@@ -51,7 +49,7 @@ sub readRelease {
"discovered in $file\n";
}
open(my $IN, '<', $file) or croak "Can't open $file: $!\n";
open(my $IN, '<', $file) or die "Can't open $file: $!\n";
$Ractive->{$file}++;
while (<$IN>) {
chomp;
@@ -79,7 +77,7 @@ sub readRelease {
if (-e $path) {
&readRelease($path, $Rmacros, $Rapps, $Ractive);
} elsif ($op eq "include") {
carp "EPICS/Release.pm: Include file '$path' not found\n";
warn "EPICS/Release.pm: Include file '$path' not found\n";
}
}
$Ractive->{$file}--;
@@ -109,9 +107,9 @@ sub expandRelease {
while (my ($macro, $val) = each %$Rmacros) {
while (my ($pre,$var,$post) = $val =~ m/ (.*) \$\( (\w+) \) (.*) /x) {
carp "EPICS/Release.pm: Undefined macro \$($var) used\n"
warn "EPICS/Release.pm: Undefined macro \$($var) used\n"
unless exists $Rmacros->{$var};
croak "EPICS/Release.pm: Circular definition of macro $macro\n"
die "EPICS/Release.pm: Circular definition of macro $macro\n"
if $macro eq $var;
$val = $pre . $Rmacros->{$var} . $post;
$Rmacros->{$macro} = $val;