gv.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl
#
# various typeglob tests
#
BEGIN {
chdir 't' if -d 't';
}
use warnings;
print "1..40\n";
# type coersion on assignment
$foo = 'foo';
# type coersion (not) on misc ops
if ($foo) {
}
}
}
# type coersion on substitutions that match
$b = $a;
$a =~ s/^X//;
$a =~ s/^\*//;
# typeglobs as lvalues
# returning glob values
sub foo {
}
}
}
# nested package globs
# NOTE: It's probably OK if these semantics change, because the
# fact that %X::Y:: is stored in %X:: isn't documented.
# (I hope.)
# test undef operator clearing out entire glob
$foo = 'stuff';
# test warnings from assignment of undef to glob
{
my $msg;
use warnings;
}
# test *glob{THING} syntax
$x = "ok 17\n";
@x = ("ok 18\n");
%x = ("ok 19" => "\n");
sub x { "ok 20\n" }
*x = *STDOUT;
# test if defined() doesn't create any new symbols
{
my $test = 23;
my $a = "SYM000";
++$test; &{$a};
}
# although it *should* if you're talking about magicals
{
my $test = 29;
my $a = "]";
$a = "1";
"o" =~ /(o)/;
$a = "2";
print "not " if ${$a};
$a = "1x";
$a = "11";
"o" =~ /(((((((((((o)))))))))))/;
}
# does pp_readline() handle glob-ness correctly?
{
my $g = *foo;
$g = <DATA>;
print $g;
}
ok 40