PerlIO::via#
Write a PerlIO layer in Perl: open with :via(MyClass) and I/O dispatches to your class.
This is a PerlIO layer implementation that delegates I/O operations to a Perl class. When a handle is opened with :via(MyClass), each PerlIO vtable method (read, write, fill, flush, etc.) calls the corresponding Perl method on the class object (MyClass->WRITE, MyClass->READ, etc.).
via.xs struct PerlIOVia extends _PerlIO (base) with: stash — HV* for the class package obj — SV* the blessed object (or class name) var — SV* buffer for FILL results cnt — SSize_t byte count remaining in var io — IO* for the filehandle to layer below fh — SV* reference to the GV wrapping io PUSHED..UTF8 — CV* cached method lookups (one per via method)
The MYMethod(x) macro expands to "METHODNAME", &s->x — passing both the string name and a pointer to the cached CV* slot.
The BOOT section registers the «via» PerlIO layer via PerlIO_define_layer.
Functions#
Other Functions#
pop_result#
Pop a single SV result off the Perl stack (equivalent of SPAGAIN; POPs). Returns a p5api SV*.