rebless.t

来自「source of perl for linux application,」· T 代码 · 共 37 行

T
37
字号
#!/usr/bin/perl -T -wBEGIN {    if( $ENV{PERL_CORE} ) {        chdir 't';        @INC = '../lib';    }}use strict;use Tie::RefHash;{  package Moose;  sub new { bless { }, shift };  package Elk;  use vars qw/@ISA/;  @ISA = "Moose";}$\ = "\n";print "1..2";my $obj = Moose->new;tie my %hash, "Tie::RefHash";$hash{$obj} = "magic";print ( ( $hash{$obj} eq "magic" ) ? "" : "not ", "ok - keyed before rebless" );bless $obj, "Elk";print ( ( $hash{$obj} eq "magic" ) ? "" : "not ", "ok - still the same");

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?