PerlIO *
PerlIOEncode_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *params)
{
- /* FIXME - Almost certainly needs more work */
- return PerlIOBase_dup(aTHX_ f, o, params);
+ if ((f = PerlIOBase_dup(aTHX_ f, o, params)))
+ {
+ PerlIOEncode *fe = PerlIOSelf(f,PerlIOEncode);
+ PerlIOEncode *oe = PerlIOSelf(o,PerlIOEncode);
+ if (oe->enc)
+ {
+ fe->enc = PerlIO_sv_dup(aTHX_ oe->enc, params);
+ }
+ }
+ return f;
}
PerlIO_funcs PerlIO_encode = {
PerlIO *
PerlIOScalar_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param)
{
- /* FIXME - Needs more work */
- return PerlIOBase_dup(aTHX_ f, o, param);
+ if ((f = PerlIOBase_dup(aTHX_ f, o, param)))
+ {
+ PerlIOScalar *fs = PerlIOSelf(f,PerlIOScalar);
+ PerlIOScalar *os = PerlIOSelf(o,PerlIOScalar);
+ /* var has been set by implicit push */
+ fs->posn = os->posn;
+ }
+ return f;
}
PerlIO_funcs PerlIO_scalar = {
SV * obj;
SV * var;
SSize_t cnt;
- Off_t posn;
IO * io;
SV * fh;
CV *PUSHED;
dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *offsv = sv_2mortal(newSViv(offset));
- SV *whsv = sv_2mortal(newSViv(offset));
+ SV *whsv = sv_2mortal(newSViv(whence));
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(SEEK),G_SCALAR,offsv,whsv,Nullsv);
return (result) ? SvIV(result) : -1;
}
dTHX;
PerlIOVia *s = PerlIOSelf(f,PerlIOVia);
SV *result = PerlIOVia_method(aTHX_ f,MYMethod(TELL),G_SCALAR,Nullsv);
- return (result) ? (Off_t) SvIV(result) : s->posn;
+ return (result) ? (Off_t) SvIV(result) : (Off_t) -1;
}
SSize_t
PerlIO *
PerlIOVia_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param)
{
- /* FIXME - Needs more work */
- return PerlIOBase_dup(aTHX_ f, o, param);
+ if ((f = PerlIOBase_dup(aTHX_ f, o, param)))
+ {
+ /* Most of the fields will lazily set them selves up as needed
+ stash and obj have been set up by the implied push
+ */
+ }
+ return f;
}
PerlIO_funcs PerlIO_object = {