4 XSLoader::load 'PerlIO::Via';
10 PerlIO::Via - Helper class for PerlIO layers implemented in perl
16 open($fh,"<:Via(Some::Package)",...);
20 The package to be used as a layer should implement at least some of the
21 following methods. In the method descriptions below I<$fh> will be
22 a reference to a glob which can be treated as a perl file handle.
23 It refers to the layer below. I<$fh> is not passed if the layer
24 is at the bottom of the stack, for this reason and to maintain
25 some level of "compatibility" with TIEHANDLE classes it is passed
30 =item $class->PUSHED([$mode][,$fh])
32 Should return an object or the class. (Compare TIEHANDLE.)
35 =item $obj->POPPED([$fh])
37 Optional - layer is about to be removed.
39 =item $class->OPEN($path,$mode[,$fh])
43 =item $class->FDOPEN($fd)
47 =item $class->SYSOPEN($path,$imode,$perm,$fh)
51 =item $obj->FILENO($fh)
53 Returns a numeric value for Unix-like file descriptor. Return -1 if
54 there isn't one. Optional. Default is fileno($fh).
56 =item $obj->READ($buffer,$len,$fh)
58 Returns the number of octets placed in $buffer (must be less that $len).
59 Optional. Default is to use FILL instead.
61 =item $obj->WRITE($buffer,$fh)
63 Returns the number of octets from buffer that have been sucessfully written.
67 Should return a string to be placed in the buffer. Optional. If not
68 provided must provide READ or reject handles open for reading in
71 =item $obj->CLOSE($fh)
73 Should return 0 on success, -1 on error.
76 =item $obj->SEEK($posn,$whence,$fh)
78 Should return 0 on success, -1 on error.
79 Optional. Default is to fail, but that is likely to be changed.
84 Optional. Default to be determined.
86 =item $obj->UNREAD($buffer,$fh)
88 Returns the number of octets from buffer that have been sucessfully
89 saved to be returned on future FILL/READ calls. Optional. Default is
90 to push data into a temporary layer above this one.
92 =item $obj->FLUSH($fh)
94 Flush any buffered write data. May possibly be called on readable
95 handles too. Should return 0 on success, -1 on error.
97 =item $obj->SETLINEBUF($fh)
101 =item $obj->CLEARERR($fh)
105 =item $obj->ERROR($fh)
107 Optional. Returns error state. Default is no error until a mechanism
108 to signal error (die?) is worked out.
112 Optional. Returns end-of-file state. Default is function of return
113 value of FILL or READ.