diff --git a/src/tools/EPICS/Copy.pm b/src/tools/EPICS/Copy.pm index 5c8f37478..59cc17fa8 100644 --- a/src/tools/EPICS/Copy.pm +++ b/src/tools/EPICS/Copy.pm @@ -7,6 +7,8 @@ # $Revision-Id$ +use Carp; + # Copy directories and files from a template sub copyTree { @@ -15,7 +17,7 @@ sub copyTree { # $Rtextsubs contains substitutions for file content. opendir my $FILES, $src - or die "opendir failed while copying $src: $!\n"; + or croak "opendir failed while copying $src: $!\n"; my @entries = readdir $FILES; closedir $FILES; @@ -36,9 +38,9 @@ sub copyTree { print "." unless $opt_d; copyFile($srcName, $dstName, $Rtextsubs); } elsif (-l $srcName) { - warn "\nSoft link in template, ignored:\n\t$srcName\n"; + carp "\nSoft link in template, ignored:\n\t$srcName\n"; } else { - warn "\nUnknown file type in template, ignored:\n\t$srcName\n"; + carp "\nUnknown file type in template, ignored:\n\t$srcName\n"; } } } @@ -46,11 +48,11 @@ sub copyTree { sub copyDir { my ($src, $dst, $Rnamesubs, $Rtextsubs) = @_; if (-e $dst && ! -d $dst) { - warn "\nTarget exists but is not a directory, skipping:\n\t$dst\n"; + carp "\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 die "Can't create $dst: $!\n" + mkdir $dst, 0777 or croak "Can't create $dst: $!\n" unless -d $dst; copyTree($src, $dst, $Rnamesubs, $Rtextsubs); } @@ -61,7 +63,7 @@ sub copyFile { print "Creating file '$dst'\n" if $opt_d; open(my $SRC, '<', $src) and open(my $DST, '>', $dst) - or die "$! copying $src to $dst\n"; + or croak "$! copying $src to $dst\n"; while (<$SRC>) { # Substitute any @VARS@ in the text s{@(\w+?)@} diff --git a/src/tools/EPICS/Release.pm b/src/tools/EPICS/Release.pm index 1cc307379..09381dfc8 100644 --- a/src/tools/EPICS/Release.pm +++ b/src/tools/EPICS/Release.pm @@ -7,6 +7,8 @@ # $Revision-Id$ +use Carp; + # # Parse all relevent configure/RELEASE* files and includes # @@ -44,7 +46,7 @@ sub readRelease { my ($file, $Rmacros, $Rapps) = @_; # $Rmacros is a reference to a hash, $Rapps a ref to an array - open(my $IN, '<', $file) or die "Can't open $file: $!\n"; + open(my $IN, '<', $file) or croak "Can't open $file: $!\n"; while (<$IN>) { chomp; s/ \r $//x; # Shouldn't need this, but sometimes... @@ -71,7 +73,7 @@ sub readRelease { if (-e $path) { &readRelease($path, $Rmacros, $Rapps); } elsif ($op eq "include") { - warn "EPICS/Release.pm: Include file '$path' not found\n"; + carp "EPICS/Release.pm: Include file '$path' not found\n"; } } close $IN; @@ -100,9 +102,9 @@ sub expandRelease { while (my ($macro, $val) = each %$Rmacros) { while (my ($pre,$var,$post) = $val =~ m/ (.*) \$\( (\w+) \) (.*) /x) { - warn "EPICS/Release.pm: Undefined macro \$($var) used\n" + carp "EPICS/Release.pm: Undefined macro \$($var) used\n" unless exists $Rmacros->{$var}; - die "EPICS/Release.pm: Circular definition of macro $macro\n" + croak "EPICS/Release.pm: Circular definition of macro $macro\n" if $macro eq $var; $val = $pre . $Rmacros->{$var} . $post; $Rmacros->{$macro} = $val;