Subject: | croak rather than die in openr / openw? |
Just a minor request.
I've patched my local copy of Path::Class::File to croak rather than die
if it can't open files (error message are much more useful) - figured
you might be interested in folding this change back in?
Cheers,
Ian
Subject: | path-class-file-croak.patch |
--- /home/bsm3/sillitoe/perl5/lib/perl5/Path/Class/File.pm 2010-03-16 11:27:23.000000000 +0000
+++ /home/bsm3/sillitoe/svn/cpan/trunk/Cath/lib/Path/Class/File.pm 2010-05-14 12:18:46.000000000 +0100
@@ -6,6 +6,7 @@
use Path::Class::Dir;
use Path::Class::Entity;
use base qw(Path::Class::Entity);
+use Carp;
use IO::File ();
@@ -57,8 +58,8 @@
sub basename { shift->{file} }
sub open { IO::File->new(@_) }
-sub openr { $_[0]->open('r') or die "Can't read $_[0]: $!" }
-sub openw { $_[0]->open('w') or die "Can't write $_[0]: $!" }
+sub openr { $_[0]->open('r') or croak "Can't read $_[0]: $!" }
+sub openw { $_[0]->open('w') or croak "Can't write $_[0]: $!" }
sub touch {
my $self = shift;
@@ -270,13 +271,13 @@
A shortcut for
- $fh = $file->open('r') or die "Can't read $file: $!";
+ $fh = $file->open('r') or croak "Can't read $file: $!";
=item $fh = $file->openw()
A shortcut for
- $fh = $file->open('w') or die "Can't write $file: $!";
+ $fh = $file->open('w') or croak "Can't write $file: $!";
=item $file->touch