The layers are popped after the file is closed, so POPPED is not useful here.
int Perl_PerlIO_close(pTHX_ PerlIO *f) { const int code = PerlIO__close(aTHX_ f); while (PerlIOValid(f)) { PerlIO_pop(aTHX_ f); } return code; }
CLOSE would seem to be the proper place, but Perl closes the layers from starting at the bottom (system level) on up. The file is already closed by the time your CLOSE handler is called.
IV PerlIOBase_close(pTHX_ PerlIO *f) { IV code = -1; if (PerlIOValid(f)) { PerlIO *n = PerlIONext(f); code = PerlIO_flush(f); PerlIOBase(f)->flags &= ~(PERLIO_F_CANREAD | PERLIO_F_CANWRITE | PERLIO_F_OPEN); while (PerlIOValid(n)) { const PerlIO_funcs * const tab = PerlIOBase(n)->tab; if (tab && tab->Close) { if ((*tab->Close)(aTHX_ n) != 0) code = -1; break; } else { PerlIOBase(n)->flags &= ~(PERLIO_F_CANREAD | PERLIO_F_CANWRITE | PERLIO_F_ +OPEN); } n = PerlIONext(n); } } else { SETERRNO(EBADF, SS_IVCHAN); } return code; }
I don't see a PerlIO solution.
In reply to Re: Create PerlIO::via layer to append data at the end of a file
by ikegami
in thread Create PerlIO::via layer to append data at the end of a file
by silly8888
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |