On Tue Sep 18 16:41:01 2012, colink@perlDreamer.com wrote:
Show quoted text> I'm not sure what Data::Printer does to the variables, but printing them
> causes scalar references to become something that Clone doesn't handle
> properly.
>
> At the risk of starting a finger pointing match, I'm going to cross post
> this to Data::Printer as well. I'd love to see Clone handle these kind
> of odd cases, but Data::Printer shouldn't be mucking about with my perl!
Hi there,
I have absolutely no idea why this is happening but I confirm it. I'm
not sure if this is a hint, but Data::Printer has been using Clone::PP
since 0.30_03.
In the code below:
* switching from Clone to Clone::PP works;
* using Clone but not calling p() works;
* only calling p() after the call to clone() works.
But after any call to p(), the call to clone() will give out the same
reference.
----------------------
use strict;
use warnings;
use 5.010;
use Clone qw(clone);
use Data::Printer;
my $a = { blue => '#0000ff', one => 1 };
say "before p: $a";
p $a; ### comment this line to make the world safe again
say "after p, before clone: $a";
my $b = clone($a);
say "after clone: $a";
say "cloned: $b";
if ($a == $b) {
say "[---] bad stuff dude.";
}
else {
say "[+++] The world works again";
}
------------------