Manual Pages for UNIX Darwin command on man PerlIO::via::dynamic
MyWebUniversity

Manual Pages for UNIX Darwin command on man PerlIO::via::dynamic

dynamic(3) User Contributed Perl Documentation dynamic(3)

NAME

PerlIO::via::dynamic - dynamic PerlIO layers

SYNOPSIS

open $fh, $fname;

$p = PerlIO::via::dynamic->new

(translate =>

sub { $[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename: $fname\$/e},

untranslate =>

sub { $[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename\$/});

$p->via ($fh);

binmode $fh, $p->via; # deprecated

DESCRIPTION

"PerlIO::via::dynamic" is used for creating dynamic PerlIO layers. It

is useful when the behavior or the layer depends on variables. You should not use this module as via layer directly (ie :via(dynamic)). Use the constructor to create new layers, with two arguments: translate

and untranslate. Then use "$p-"via ($fh)> to wrap the handle. Once

<$fh> is destroyed, the temporary namespace for the IO layer will be

removed.

Note that PerlIO::via::dynamic uses the scalar fields to reference to

the object representing the dynamic namespace. OOPPTTIIOONNSS translate A function that translate buffer upon write. untranslate A function that translate buffer upon read. useread Use "READ" instead of "FILL" for the layer. Useful when caller expect exact amount of data from read, and the "untranslate" function might return different length.

By default "PerlIO::via::dynamic" creates line-based layer to make

"translate" implementation easier. AUTHORS

Chia-liang Kao

COPYRIGHT

Copyright 2004 by Chia-liang Kao .

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See

perl v5.8.8 2006-03-06 dynamic(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™