From: Nick Ing-Simmons Date: Thu, 29 Mar 2001 09:03:43 +0000 (+0000) Subject: Noticed that two tests were skipped as perlio:: package X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0e62c2a4ed4c005b9afcfe9fe3e1838fcea785d;p=p5sagit%2Fp5-mst-13.2.git Noticed that two tests were skipped as perlio:: package isn't there any more. Changed the skip condition. Avoid core-dump if sv_utf8_upgrade() called on something that does not become SvPOK after SvPV() (e.g. a ref). p4raw-id: //depot/perlio@9429 --- diff --git a/sv.c b/sv.c index 7e98be6..704718e 100644 --- a/sv.c +++ b/sv.c @@ -2966,8 +2966,12 @@ Perl_sv_utf8_upgrade(pTHX_ register SV *sv) if (!sv) return 0; - if (!SvPOK(sv)) - (void) SvPV_nolen(sv); + if (!SvPOK(sv)) { + STRLEN len = 0; + (void) sv_2pv(sv,&len); + if (!SvPOK(sv)) + return len; + } if (SvUTF8(sv)) return SvCUR(sv); diff --git a/t/io/utf8.t b/t/io/utf8.t index 07e626f..38d7007 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -3,7 +3,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; - unless (defined &perlio::import) { + unless (exists $open::layers{'perlio'}) { print "1..0 # Skip: not perlio\n"; exit 0; } diff --git a/t/lib/io_scalar.t b/t/lib/io_scalar.t index 569abd7..3679550 100644 --- a/t/lib/io_scalar.t +++ b/t/lib/io_scalar.t @@ -3,7 +3,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; - unless (defined &perlio::import) { + unless (exists $open::layers{'perlio'}) { print "1..0 # Skip: not perlio\n"; exit 0; }