A Solution of sorts push @trusted,$self->trusted(); my %trusted_classes ; @trusted_classes{@trusted} = () x @trusted; my $blesser = sub { my ( $ref, $class ) = @_; if ( exists $trusted_classes{$class} ) { bless $ref, $class; } }; my $parser = Data::DumpXML::Parser->new(Blesser => $blesser);