summaryrefslogtreecommitdiff
path: root/t/io/open.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-04-09 10:40:31 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-04-09 10:40:31 +0000
commit0c4b0a3f6df5172b70e3383e7419936faa3fc0a0 (patch)
tree187c7ae5fb1531eac2d9546c326c99cbc5c9783e /t/io/open.t
parent294d099eb0fb837b82ab70fe7f81a0b70a4fa5c9 (diff)
downloadperl-0c4b0a3f6df5172b70e3383e7419936faa3fc0a0.tar.gz
Try to be more descriptive than just __ANONIO__ which is what
you get when you autovivify filehandles into array/hash elements. p4raw-id: //depot/perl@19172
Diffstat (limited to 't/io/open.t')
-rwxr-xr-xt/io/open.t33
1 files changed, 32 insertions, 1 deletions
diff --git a/t/io/open.t b/t/io/open.t
index 9e067b74f6..300525ac05 100755
--- a/t/io/open.t
+++ b/t/io/open.t
@@ -12,7 +12,7 @@ use Config;
$Is_VMS = $^O eq 'VMS';
$Is_MacOS = $^O eq 'MacOS';
-plan tests => 95;
+plan tests => 99;
my $Perl = which_perl();
@@ -244,3 +244,34 @@ SKIP: {
ok( !eval { open F, "BAR", "QUUX" }, 'Unknown open() mode' );
like( $@, qr/\QUnknown open() mode 'BAR'/, ' right error' );
}
+
+{
+ local $SIG{__WARN__} = sub { $@ = shift };
+
+ sub gimme {
+ my $tmphandle = shift;
+ my $line = scalar <$tmphandle>;
+ warn "gimme";
+ return $line;
+ }
+
+ open($fh0[0], "TEST");
+ gimme($fh0[0]);
+ like($@, qr/<\$fh0\[...\]> line 1\./, "autoviv fh package aelem");
+
+ open($fh1{k}, "TEST");
+ gimme($fh1{k});
+ like($@, qr/<\$fh1{...}> line 1\./, "autoviv fh package helem");
+
+ my @fh2;
+ open($fh2[0], "TEST");
+ gimme($fh2[0]);
+ like($@, qr/<\$fh2\[...\]> line 1\./, "autoviv fh lexical aelem");
+
+ my %fh3;
+ open($fh3{k}, "TEST");
+ gimme($fh3{k});
+ like($@, qr/<\$fh3{...}> line 1\./, "autoviv fh lexical helem");
+
+}
+