in reply to Track open file handles
There is a bug where it says...
@_ > 2 ? open $_[0],$_[1],$_[2] : open $_[0], $_[1];
open can accept more than two arguments (i.e. when piping to/from an external program), so, you should use instead...
@_ > 2 ? open $_[0],$_[1],@_[2..$#_] : open $_[0], $_[1];
Also, I am not sure that would work for the cases where the second argument is a string with a file handler embedded, as for instance open($fh, ">&STDOUT") or its three-args form open($fh, ">&", "STDOUT"). You will probably need to prefix those names with the calling package name.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Track open file handles
by shmem (Chancellor) on Apr 06, 2017 at 12:51 UTC | |
by salva (Canon) on Apr 06, 2017 at 13:35 UTC | |
by Eily (Monsignor) on Apr 06, 2017 at 16:52 UTC | |
by shmem (Chancellor) on Apr 06, 2017 at 21:06 UTC | |
by salva (Canon) on Apr 07, 2017 at 08:57 UTC | |
by shmem (Chancellor) on Apr 07, 2017 at 09:36 UTC |
In Section
Cool Uses for Perl