ext/PerlIO/encoding/encoding.xs PerlIO::encoding
ext/PerlIO/encoding/Makefile.PL PerlIO::encoding makefile writer
ext/PerlIO/encoding/MANIFEST PerlIO::encoding list of files
+ext/PerlIO/encoding/t/nolooping.t Tests for PerlIO::encoding
ext/PerlIO/scalar/Makefile.PL PerlIO layer for scalars
ext/PerlIO/scalar/scalar.pm PerlIO layer for scalars
ext/PerlIO/scalar/scalar.xs PerlIO layer for scalars
package PerlIO::encoding;
use strict;
-our $VERSION = '0.09';
+our $VERSION = '0.10';
our $DEBUG = 0;
$DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n";
SV *enc; /* the encoding object */
SV *chk; /* CHECK in Encode methods */
int flags; /* Flags currently just needs lines */
+ int inEncodeCall; /* trap recursive encode calls */
} PerlIOEncode;
#define NEEDS_LINES 1
}
e->chk = newSVsv(get_sv("PerlIO::encoding::fallback", 0));
+ e->inEncodeCall = 0;
FREETMPS;
LEAVE;
STRLEN len;
SSize_t count = 0;
if ((PerlIOBase(f)->flags & PERLIO_F_WRBUF) && (e->base.ptr > e->base.buf)) {
+ if (e->inEncodeCall) return 0;
/* Write case - encode the buffer and write() to layer below */
PUSHSTACKi(PERLSI_MAGIC);
SPAGAIN;
XPUSHs(e->bufsv);
XPUSHs(e->chk);
PUTBACK;
+ e->inEncodeCall = 1;
if (call_method("encode", G_SCALAR) != 1) {
+ e->inEncodeCall = 0;
Perl_die(aTHX_ "panic: encode did not return a value");
}
+ e->inEncodeCall = 0;
SPAGAIN;
str = POPs;
PUTBACK;
}
/* See if there is anything left in the buffer */
if (e->base.ptr < e->base.end) {
+ if (e->inEncodeCall) return 0;
/* Bother - have unread data.
re-encode and unread() to layer below
*/
XPUSHs(str);
XPUSHs(e->chk);
PUTBACK;
+ e->inEncodeCall = 1;
if (call_method("encode", G_SCALAR) != 1) {
- Perl_die(aTHX_ "panic: encode did not return a value");
+ e->inEncodeCall = 0;
+ Perl_die(aTHX_ "panic: encode did not return a value");
}
+ e->inEncodeCall = 0;
SPAGAIN;
str = POPs;
PUTBACK;
--- /dev/null
+#!perl -w
+
+use Test::More tests => 1;
+
+# bug #41442
+use open ':locale';
+if (-e '/dev/null') { open STDERR, '>', '/dev/null' }
+warn "# \x{201e}\n"; # „
+ok(1); # we got that far