1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6 set_up_inc('../lib'); 7} 8 9plan tests => 7; 10 11use utf8; 12use open qw( :utf8 :std ); 13 14# [perl #19566]: sv_gets writes directly to its argument via 15# TARG. Test that we respect SvREADONLY. 16use constant roref=>\2; 17eval { for (roref) { $_ = <Fʜ> } }; 18like($@, qr/Modification of a read-only value attempted/, '[perl #19566]'); 19 20# [perl #21628] 21{ 22 my $file = tempfile(); 23 open Ạ,'+>',$file; $a = 3; 24 is($a .= <Ạ>, 3, '#21628 - $a .= <A> , A eof'); 25 close Ạ; $a = 4; 26 is($a .= <Ạ>, 4, '#21628 - $a .= <A> , A closed'); 27} 28 29use strict; 30my $err; 31{ 32 no warnings qw(deprecated); 33 open ᕝ, '.' and sysread ᕝ, $_, 1; 34 $err = $! + 0; 35 close ᕝ; 36} 37 38SKIP: { 39 skip "you can read directories as plain files", 2 unless( $err ); 40 41 $!=0; 42 open ᕝ, '.' and $_=<ᕝ>; 43 ok( $!==$err && !defined($_) => 'readline( DIRECTORY )' ); 44 close ᕝ; 45 46 $!=0; 47 { local $/; 48 open ᕝ, '.' and $_=<ᕝ>; 49 ok( $!==$err && !defined($_) => 'readline( DIRECTORY ) slurp mode' ); 50 close ᕝ; 51 } 52} 53 54my $obj = bless [], "Ȼლᔆ"; 55$obj .= <DATA>; 56like($obj, qr/Ȼლᔆ=ARRAY.*world/u, 'rcatline and refs'); 57 58{ 59 my $file = tempfile(); 60 open my $out_fh, ">", $file; 61 print { $out_fh } "Data\n"; 62 close $out_fh; 63 64 open hòฟ, "<", $file; 65 is( scalar(<hòฟ>), "Data\n", "readline() works correctly on UTF-8 filehandles" ); 66 close hòฟ; 67} 68 69__DATA__ 70world 71