From: Jarkko Hietaniemi Date: Wed, 16 Apr 2003 10:20:46 +0000 (+0000) Subject: PerlIO::get_layers() usage tip. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ae85e5961e1ee7057020436524ffba6c7125d25;p=p5sagit%2Fp5-mst-13.2.git PerlIO::get_layers() usage tip. p4raw-id: //depot/perl@19234 --- diff --git a/lib/PerlIO.pm b/lib/PerlIO.pm index 9d3822c..c89c068 100644 --- a/lib/PerlIO.pm +++ b/lib/PerlIO.pm @@ -228,7 +228,8 @@ This can be used to see the effect of/bugs in the various layers e.g. The following returns the B of the PerlIO layers on a filehandle. - my @layers = PerlIO::get_layers(FH); + my @layers = PerlIO::get_layers($fh); + # You can use also FH or *FH, the bare FH doesn't pass 'use strict'. The layers are returned in the order an open() or binmode() call would use them. Note that the stack begins (normally) from C or from @@ -238,10 +239,11 @@ C) is not part of the stack, but under C it is. By default the layers from the input side of the filehandle is returned, to get the output side use the optional C argument: - my @layers = PerlIO::get_layers(FH, output => 1); + my @layers = PerlIO::get_layers($fh, output => 1); (Usually the layers are identical on either side of a filehandle but -for example with sockets there may be differences.) +for example with sockets there may be differences, or if you have +been using the C pragma.) There is no set_layers(), nor does get_layers() return a tied array mirroring the stack, or anything fancy like that. This is not @@ -256,7 +258,7 @@ the name of the layer, and certain layers (like C) are not real layers but instead flags on real layers: to get all of these returned separately use the optional C argument: - my @layer_and_args_and_flags = PerlIO::get_layers(FH, details => 1); + my @layer_and_args_and_flags = PerlIO::get_layers($fh, details => 1); The result will be up to be three times the number of layers: the first element will be a name, the second element the arguments