diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-02-24 14:35:54 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-02-24 14:54:16 -0500 |
commit | fde03e8b559d0e00bf4acd8cea3bb49411099c34 (patch) | |
tree | f5484ce99293a18a88cf1a4aff8c12b12e25bffa /src/test/perl/RecursiveCopy.pm | |
parent | 32291aed494d425a548e45b3b6ad95f9d5c94e67 (diff) |
Use croak instead of die in Perl code when appropriate
Diffstat (limited to 'src/test/perl/RecursiveCopy.pm')
-rw-r--r-- | src/test/perl/RecursiveCopy.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/test/perl/RecursiveCopy.pm b/src/test/perl/RecursiveCopy.pm index 19f7dd2fffe..5bce720b356 100644 --- a/src/test/perl/RecursiveCopy.pm +++ b/src/test/perl/RecursiveCopy.pm @@ -19,6 +19,7 @@ package RecursiveCopy; use strict; use warnings; +use Carp; use File::Basename; use File::Copy; @@ -68,7 +69,7 @@ sub copypath if (defined $params{filterfn}) { - die "if specified, filterfn must be a subroutine reference" + croak "if specified, filterfn must be a subroutine reference" unless defined(ref $params{filterfn}) and (ref $params{filterfn} eq 'CODE'); @@ -80,7 +81,7 @@ sub copypath } # Complain if original path is bogus, because _copypath_recurse won't. - die "\"$base_src_dir\" does not exist" if !-e $base_src_dir; + croak "\"$base_src_dir\" does not exist" if !-e $base_src_dir; # Start recursive copy from current directory return _copypath_recurse($base_src_dir, $base_dest_dir, "", $filterfn); @@ -98,11 +99,11 @@ sub _copypath_recurse # Check for symlink -- needed only on source dir # (note: this will fall through quietly if file is already gone) - die "Cannot operate on symlink \"$srcpath\"" if -l $srcpath; + croak "Cannot operate on symlink \"$srcpath\"" if -l $srcpath; # Abort if destination path already exists. Should we allow directories # to exist already? - die "Destination path \"$destpath\" already exists" if -e $destpath; + croak "Destination path \"$destpath\" already exists" if -e $destpath; # If this source path is a file, simply copy it to destination with the # same name and we're done. @@ -148,7 +149,7 @@ sub _copypath_recurse return 1 if !-e $srcpath; # Else it's some weird file type; complain. - die "Source path \"$srcpath\" is not a regular file or directory"; + croak "Source path \"$srcpath\" is not a regular file or directory"; } 1; |