summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/doio.c b/doio.c
index decd1885a4..0be42df8c1 100644
--- a/doio.c
+++ b/doio.c
@@ -254,10 +254,6 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
name = type;
len = tend-type;
}
- else {
- if (*type)
- goto unknown_desr;
- }
if (*name == '\0') {
/* command is missing 19990114 */
if (ckWARN(WARN_PIPE))
@@ -285,6 +281,13 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
else {
fp = PerlProc_popen(name,mode);
}
+ if (num_svs) {
+ if (*type) {
+ if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) {
+ goto say_false;
+ }
+ }
+ }
}
else if (*type == IoTYPE_WRONLY) {
TAINT_PROPER("open");
@@ -320,7 +323,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
if (num_svs > 1) {
Perl_croak(aTHX_ "More than one argument to '%c&' open",IoTYPE(io));
}
- if (num_svs && SvIOK(*svp)) {
+ if (num_svs && (SvIOK(*svp) || (SvPOK(*svp) && looks_like_number(*svp)))) {
fd = SvUV(*svp);
}
else if (isDIGIT(*type)) {
@@ -487,6 +490,14 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
fp = PerlProc_popen(name,mode);
}
IoTYPE(io) = IoTYPE_PIPE;
+ if (num_svs) {
+ for (; isSPACE(*type); type++) ;
+ if (*type) {
+ if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) {
+ goto say_false;
+ }
+ }
+ }
}
else {
if (num_svs)