This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Tie-RefHash-1.38
[perl5.git] / lib / Tie / RefHash / rebless.t
CommitLineData
f0f40d86
RGS
1#!/usr/bin/perl -T -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = '../lib';
7 }
8}
9
10use strict;
11
12use Tie::RefHash;
13
14{
15 package Moose;
16 sub new { bless { }, shift };
17
18 package Elk;
19 use vars qw/@ISA/;
20 @ISA = "Moose";
21}
22
23$\ = "\n";
24print "1..2";
25
26my $obj = Moose->new;
27
28tie my %hash, "Tie::RefHash";
29
30$hash{$obj} = "magic";
31
32print ( ( $hash{$obj} eq "magic" ) ? "" : "not ", "ok - keyed before rebless" );
33
34bless $obj, "Elk";
35
36print ( ( $hash{$obj} eq "magic" ) ? "" : "not ", "ok - still the same");