A helper class for PerlIO layers implemented in Perl. PerlIO::Via ships with the Perl 5.8 source kit.
For example, you can use PerlIO::Via to call MIME::Base64::encode_base64() via open():
#!/usr/local/bin/perl -w; use MIME::Base64; open(my $fh, ">Via(MIME::Base64)", "encode_base64");
PerlIO::Via implements the following methods.
CLOSE |
CLOSE(fh)
Returns 0 on success and -1 on error.
EOF |
EOF(fh)
Returns end-of-file state. The default behavior is to return a value of FILL() or READ().
ERROR |
ERROR(fh)
Returns error state.
FILENO |
FILENO(fh)
Returns a numeric value that represents the Unix-like file descriptor, or -1 if no file descriptor exists.
FILL |
FILL(fh)
Returns a string that will be placed in the buffer.
FLUSH |
FLUSH(fh)
Flushes any buffered write data. Returns 0 on success and -1 on error.
POPPED |
POPPED([fh])
Removes a layer from PerlIO::Via.
PUSHED |
$class->PUSHED([mode [,fh]])
Returns an object or the class, or -1 on failure. PUSHED takes optional arguments for file open mode—r, w, w+, etc.—and takes a mandatory filehandle for the PerlIO layer itself.
READ |
READ(buffer, len, fh)
Returns the number of octets in buffer, which must be less than or equal to len.
SEEK |
SEEK(posn, where, fh)
Returns 0 on success and -1 on error.
TELL |
TELL(fh)
Returns the file position, without an available default.
UNREAD |
UNREAD(buffer, fh)
Returns the number of octets from bufferthat have been successfully saved.
Copyright © 2002 O'Reilly & Associates. All rights reserved.