use strict;
use warnings;
use Data::Dump qw/pp/;
use Scalar::Util qw/blessed/;


#my $hr = bless { key => 'val' }, 'TROYAN';

my $hr = { key => 'val' };

$hr = TROYAN->new($hr);
#warn blessed $hr;


print $hr->{key2};


package TROYAN;
use Data::Dump qw/pp/;
use Scalar::Util qw/blessed reftype/;

use overload
  '%{}' => sub {
      my ($self) = @_;
      #warn 'OL %{} :', blessed $self;
      #unbless $self;
      #warn reftype $self->{orig};
      return { key2 => 'val2'};#, orig => $self->{orig} };
  },
  ;


sub new {
    my ($class,$ref) = @_;
    bless { orig => $ref }, __PACKAGE__;
}

