# Currently it only tests the untie warning
chdir 't' if -d 't';
-unshift @INC, "../lib";
+@INC = '../lib';
$ENV{PERL5LIB} = "../lib";
$|=1;
# catch warnings into fatal errors
$SIG{__WARN__} = sub { die "WARNING: @_" } ;
+$SIG{__DIE__} = sub { die @_ };
undef $/;
@prgs = split "\n########\n", <DATA>;
$results = $@ ;
$results =~ s/\n+$//;
$expected =~ s/\n+$//;
- if ( $status or $results and $results !~ /^WARNING: $expected/){
+ if ( $status or $results and $results !~ /^(WARNING: )?$expected/){
print STDERR "STATUS: $status\n";
print STDERR "PROG: $prog\n";
print STDERR "EXPECTED:\n$expected\n";
EXPECT
########
+# standard behaviour, without any extra references
+use Tie::Hash ;
+{package Tie::HashUntie;
+ use base 'Tie::StdHash';
+ sub UNTIE
+ {
+ warn "Untied\n";
+ }
+}
+tie %h, Tie::HashUntie;
+untie %h;
+EXPECT
+Untied
+########
+
# standard behaviour, with 1 extra reference
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
# strict behaviour, without any extra references
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
untie %h;
# strict behaviour, with 1 extra references generating an error
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
untie %h;
# strict behaviour, with 1 extra references via tied generating an error
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
$a = tied %h;
# strict behaviour, with 1 extra references which are destroyed
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
$a = 0 ;
# strict behaviour, with extra 1 references via tied which are destroyed
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
$a = tied %h;
# strict error behaviour, with 2 extra references
use warnings 'untie';
-#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
$b = tied %h ;
# strict behaviour, check scope of strictness.
no warnings 'untie';
-#local $^W = 0 ;
use Tie::Hash ;
$A = tie %H, Tie::StdHash;
$C = $B = tied %H ;
{
use warnings 'untie';
- #local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
untie %h;
}
die unless $a == $b;
EXPECT
+Self-ties are not supported
########
# Interaction of tie and vec