in reply to Re: Sending filehandles?
in thread Sending filehandles?
I've ... included $! in die.
You've only done half the job there :-). If you don't put both the filename and the OS error in the error message, the user can't diagnose the actual problem. OP's (unhelpful) error message:
Your (fractionally more helpful) error message:Could not open file
This:Could not open file: Permission denied
yields a helpful error message:open(my $FILEHANDLE, ">", $filename) or die "Cannot open $filename: $!";
To be super-picky, it's "Cannot open", not "Can't open", or "Could not open", or any other variation. In English, at least.Cannot open /dev/secret: Permission denied
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Sending filehandles?
by DrHyde (Prior) on Feb 12, 2008 at 11:07 UTC | |
by djp (Hermit) on Feb 13, 2008 at 05:24 UTC | |
by DrHyde (Prior) on Feb 13, 2008 at 10:47 UTC |
In Section
Seekers of Perl Wisdom