in reply to Trouble making my own open()-like routines.
You probably need, for one thing, to pass the typeglob, not the bareword filehandle. I understand the prototypes, but they need to come before the sub is ever called... and prototypes are an ugly world anyway. Even better, pass a lexical just as you would if you said, "open my $fh, $filename or die $!;".
And next, you should probably be using the three arg version of open. That's safer.
And next... you should probably die instead of just returning if you fail to open the file. Currently, when you fail to open the file, you'll never know why. You could die, print $! for details on why you failed.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trouble making my own open()-like routines.
by ysth (Canon) on Jul 07, 2004 at 15:30 UTC | |
by William G. Davis (Friar) on Jul 07, 2004 at 23:53 UTC |