# test::load
package test::load;
require Exporter;
our @ISA = qw/Exporter/;
our @EXPORT = qw/new copy/;
sub copy
{ my $self ;
my $x = shift;
my $y = $x -> {B};
$y .= $y;
$self -> {YY} = $y;
bless $self;
return $self;
}
sub new
{ my $self;
$self -> {A} = shift;
$self -> {B} = shift;
bless $self;
return $self;
}
1;
__END__
# main
use test::load;
my $x = test::load -> new ( AAA => 111 );
my $y = $x ->copy ;
my $z = $y;
$y->{YY} = 100;
print $z -> {YY};
__END__
Question :
How can I make $z become another (blessed) thing ?
So when I modify something in $y , and not affecting $z ?
Thanks in advise,
Bee