I'm using a sub which expects as parameter a string describing a layer. [...] Is it sufficient to just use the empty string, ''
It doesn't matter what you pass to your sub. What matters is what you pass to open. Passing an empty string to open (for the second argument) is an error. You also need to specify the mode.
>perl -e"open my $fh, '', 'foo'" Unknown open() mode '' at -e line 1.
Not specifying any layers causes open to use the default (hardcoded, from $ENV{PERLIO} or from use open).
sub myopen { my (..., $perlio, ...) = @_; $perlio ||= ''; ... open(my $fh, ">$perlio", ...) or die ...; ... } myopen(..., ':raw:perlio', ...); # bin mode with buffering myopen(..., '', ...); # default myopen(..., ); # default
In reply to Re: How to specify the default IO layer?
by ikegami
in thread How to specify the default IO layer?
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |