From: Jarkko Hietaniemi Date: Sun, 12 Aug 2001 03:30:07 +0000 (+0000) Subject: Drop all the unnecessary "use utf8" clauses and some of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=169da83847a2059e4bc997fdd0d3f1afb5af3a3f;p=p5sagit%2Fp5-mst-13.2.git Drop all the unnecessary "use utf8" clauses and some of the unnecessary "use bytes" ones. TODO: scour the documentation for unnecessary "use utf8" and prominently display it in perldelta when the time comes. ("use utf8" should be necessary ONLY if one wants the script to be in UTF-8.) Also should be checked in some non-ASCII non-Latin-1 platform, like EBCDIC. p4raw-id: //depot/perl@11638 --- diff --git a/t/comp/require.t b/t/comp/require.t index 0741561..103a579 100755 --- a/t/comp/require.t +++ b/t/comp/require.t @@ -86,7 +86,6 @@ print "not " unless 5.5.1 gt v5.5; print "ok ",$i++,"\n"; { - use utf8; print "not " unless v5.5.640 eq "\x{5}\x{5}\x{280}"; print "ok ",$i++,"\n"; diff --git a/t/io/utf8.t b/t/io/utf8.t index 224dfd7..0d5700d 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -9,7 +9,7 @@ BEGIN { } } -no utf8; # so that the naked 8-bit chars won't gripe under use utf8 +no utf8; # needed for use utf8 not griping about the raw octets $| = 1; my $total_tests = 25; diff --git a/t/op/concat.t b/t/op/concat.t index 76074e0..5ae7da5 100644 --- a/t/op/concat.t +++ b/t/op/concat.t @@ -28,7 +28,6 @@ my $test = 4; $_ = $dx = "\x{10f2}"; s/($dx)/$dx$1/; { - use bytes; print "not " unless $_ eq "$dx$dx"; print "ok $test\n"; $test++; @@ -37,7 +36,6 @@ my $test = 4; $_ = $dx = "\x{10f2}"; s/($dx)/$1$dx/; { - use bytes; print "not " unless $_ eq "$dx$dx"; print "ok $test\n"; $test++; @@ -47,7 +45,6 @@ my $test = 4; $_ = "\x{10f2}\x{10f2}"; s/($dx)($dx)/$1$2/; { - use bytes; print "not " unless $_ eq "$dx$dx"; print "ok $test\n"; $test++; diff --git a/t/op/each.t b/t/op/each.t index 6dd1cea..eb2dce0 100755 --- a/t/op/each.t +++ b/t/op/each.t @@ -158,27 +158,23 @@ print "not " if exists $b{$A}; print "ok 21\n"; print "not " if exists $u{$a}; print "ok 22\n"; -print "#$b{$_}\n" for keys %b; # Used to core dump before change #8056. +print "# $b{$_}\n" for keys %b; # Used to core dump before change #8056. print "ok 23\n"; -print "#$u{$_}\n" for keys %u; # Used to core dump before change #8056. +print "# $u{$_}\n" for keys %u; # Used to core dump before change #8056. print "ok 24\n"; -use bytes (); - # on EBCDIC chars are mapped differently so pick something that needs encoding # there too. $d = pack("U*", 0xe3, 0x81, 0xAF); -$ol = bytes::length($d); +{ use bytes; $ol = bytes::length($d) } print "not " unless $ol > 3; print "ok 25\n"; %u = ($d => "downgrade"); for (keys %u) { - use bytes; print "not " if length ne 3 or $_ ne "\xe3\x81\xAF"; print "ok 26\n"; } { - use bytes; - print "not " if length($d) != $ol; + { use bytes; print "not " if bytes::length($d) != $ol } print "ok 27\n"; } diff --git a/t/op/pat.t b/t/op/pat.t index 270d65a..bed2f37 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -1287,7 +1287,7 @@ print "ok 247\n"; "#latin[$latin]\nnot ok $test\n"; $test++; $latin =~ s/stra\337e/straße/; # \303\237 after the 2nd a - use utf8; + use utf8; # needed for the raw UTF-8 $latin =~ s!(s)tr(?:aß|s+e)!$1tr.!; # \303\237 after the a } } diff --git a/t/op/regmesg.t b/t/op/regmesg.t index 24f6f31..82f6ee9 100644 --- a/t/op/regmesg.t +++ b/t/op/regmesg.t @@ -61,7 +61,7 @@ my @death = '/\p{x/' => 'Missing right brace on \p{} in regex; marked by {#} in m/\p{{#}x/', - 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/', + '/[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/', '/(x)\2/' => 'Reference to nonexistent group in regex; marked by {#} in m/(x)\2{#}/', @@ -69,7 +69,7 @@ my @death = '/\x{1/' => 'Missing right brace on \x{} in regex; marked by {#} in m/\x{{#}1/', - 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/', + '/[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/', '/[[:barf:]]/' => 'POSIX class [:barf:] unknown in regex; marked by {#} in m/[[:barf:]{#}]/', diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 89992d6..01b36fe 100755 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -4,7 +4,7 @@ # doubles (if supported), of machine-specific short and long # integers, machine-specific floating point exceptions (infinity, # not-a-number ...), of the effects of locale, and of features -# specific to multi-byte characters (under use utf8 and such). +# specific to multi-byte characters (under the utf8 pragma and such). BEGIN { chdir 't' if -d 't'; diff --git a/t/op/tr.t b/t/op/tr.t index 1e30365..6390f6a 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -80,9 +80,6 @@ else { print "ok 10\n"; { -if (ord("\t") == 9) { # ASCII - use utf8; -} # 11 - changing UTF8 characters in a UTF8 string, same length. my $l = chr(300); my $r = chr(400); $x = 200.300.400;