1#!./perl 2 3# Test the Internal::* functions and other tibits in universal.c 4 5BEGIN { 6 chdir 't' if -d 't'; 7 @INC = '../lib'; 8 require './test.pl'; 9 plan( tests => 5 ); 10} 11 12for my $arg ('', 'q[]', qw( 1 undef )) { 13 fresh_perl_is(<<"----", <<'====', "Internals::* functions check their argument under func() AND &func() [perl #77776]"); 14sub tryit { eval shift or warn \$@ } 15tryit "&Internals::SvREADONLY($arg)"; 16tryit "&Internals::SvREFCNT($arg)"; 17tryit "&Internals::hv_clear_placeholders($arg)"; 18tryit "&Internals::HvREHASH($arg)"; 19---- 20Usage: Internals::SvREADONLY(SCALAR[, ON]) at (eval 1) line 1. 21Usage: Internals::SvREFCNT(SCALAR[, REFCOUNT]) at (eval 2) line 1. 22Usage: Internals::hv_clear_placeholders(hv) at (eval 3) line 1. 23Internals::HvREHASH $hashref at (eval 4) line 1. 24==== 25} 26 27# Various conundrums with SvREADONLY 28 29$x = *foo; 30Internals::SvREADONLY $x, 1; 31eval { $x = [] }; 32like $@, qr/Modification of a read-only value attempted at/, 33 'read-only glob copies'; 34