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 open ���, '.' and binmode ��� and sysread ���, $_, 1; 33 $err = $! + 0; 34 close ���; 35} 36 37SKIP: { 38 skip "you can read directories as plain files", 2 unless( $err ); 39 40 $!=0; 41 open ���, '.' and $_=<���>; 42 ok( $!==$err && !defined($_) => 'readline( DIRECTORY )' ); 43 close ���; 44 45 $!=0; 46 { local $/; 47 open ���, '.' and $_=<���>; 48 ok( $!==$err && !defined($_) => 'readline( DIRECTORY ) slurp mode' ); 49 close ���; 50 } 51} 52 53my $obj = bless [], "��������"; 54$obj .= <DATA>; 55like($obj, qr/��������=ARRAY.*world/u, 'rcatline and refs'); 56 57{ 58 my $file = tempfile(); 59 open my $out_fh, ">", $file; 60 print { $out_fh } "Data\n"; 61 close $out_fh; 62 63 open h�����, "<", $file; 64 is( scalar(<h�����>), "Data\n", "readline() works correctly on UTF-8 filehandles" ); 65 close h�����; 66} 67 68__DATA__ 69world 70