Skip to content

Instantly share code, notes, and snippets.

@exodist
Created May 1, 2015 18:33
Show Gist options
  • Save exodist/93efb79fc227ec799687 to your computer and use it in GitHub Desktop.
Save exodist/93efb79fc227ec799687 to your computer and use it in GitHub Desktop.
mongodb error point of problem in Test-Simple
#https://github.com/Test-More/test-more/blob/stream/master/lib/Test/Stream/Context.pm#L263
# expanded:
# This still demonstrates problem:
sub snapshot {
my ($self, $type, $copy, $new);
$self = shift;
$type = blessed($self);
$copy = {%$self};
$new = bless $copy, $type;
return $new;
}
# This fixes it:
sub snapshot {
my ($self, $type, $copy, $new);
$self = shift;
$type = blessed($self);
{ local $_; $copy = {%$self}; }
$new = bless $copy, $type;
return $new;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment