11 # [perl #19566]: sv_gets writes directly to its argument via
12 # TARG. Test that we respect SvREADONLY.
13 eval { for (\2) { $_ = <FH> } };
14 like($@, 'Modification of a read-only value attempted', '[perl #19566]');
18 my $file = tempfile();
19 open A,'+>',$file; $a = 3;
20 is($a .= <A>, 3, '#21628 - $a .= <A> , A eof');
22 is($a .= <A>, 4, '#21628 - $a .= <A> , A closed');
25 # [perl #21614]: 82 is chosen to exceed the length for sv_grow in
27 foreach my $k (1, 82) {
29 = runperl (stdin => '', stderr => 1,
30 prog => "\$x = q(k) x $k; \$a{\$x} = qw(v); \$_ = <> foreach keys %a; print qw(end)",
32 $result =~ s/\n\z// if $^O eq 'VMS';
33 is ($result, "end", '[perl #21614] for length ' . length('k' x $k));
37 foreach my $k (1, 21) {
39 = runperl (stdin => ' rules', stderr => 1,
40 prog => "\$x = q(perl) x $k; \$a{\$x} = q(v); foreach (keys %a) {\$_ .= <>; print}",
42 $result =~ s/\n\z// if $^O eq 'VMS';
43 is ($result, ('perl' x $k) . " rules", 'rcatline to shared sv for length ' . length('perl' x $k));
46 foreach my $l (1, 82) {
51 is ($k, "moo\n", 'catline to COW sv for length ' . length $copy);
55 foreach my $l (1, 21) {
60 is ($k, "$perl rules\n", 'rcatline to COW sv for length ' . length $perl);
66 open F, File::Spec->curdir and sysread F, $_, 1;
71 skip "you can read directories as plain files", 2 unless( $err );
74 open F, File::Spec->curdir and $_=<F>;
75 ok( $!==$err && !defined($_) => 'readline( DIRECTORY )' );
80 open F, File::Spec->curdir and $_=<F>;
81 ok( $!==$err && !defined($_) => 'readline( DIRECTORY ) slurp mode' );
86 fresh_perl_is('BEGIN{<>}', '',
87 { switches => ['-w'], stdin => '', stderr => 1 },
88 'No ARGVOUT used only once warning');
90 fresh_perl_is('print readline', 'foo',
91 { switches => ['-w'], stdin => 'foo', stderr => 1 },
92 'readline() defaults to *ARGV');
96 like($obj, qr/main=ARRAY.*world/, 'rcatline and refs');
100 tie our $one, 'Tie::StdScalar', "A: ";
101 tie our $two, 'Tie::StdScalar', "B: ";
105 is( $one, "A: One\n", "rcatline works with tied scalars" );
106 is( $two, "B: Two\n", "rcatline works with tied scalars" );