in reply to Create PerlIO::via layer to append data at the end of a file
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Create PerlIO::via layer to append data at the end of a file
by ikegami (Patriarch) on Jun 15, 2010 at 21:30 UTC | |
by silly8888 (Initiate) on Jun 16, 2010 at 04:46 UTC |