Math-SimpleHisto-XS

 view release on metacpan or  search on metacpan

lib/Math/SimpleHisto/XS/Named.pm  view on Meta::CPAN


sub new_from_dump {
  my $class = shift;
  my $type = lc(shift);
  my $data = shift;

  my $struct = $Math::SimpleHisto::XS::JSON->decode($data);
  $class = delete $struct->{class};
  my $hclass = delete $struct->{histclass};
  $struct->{hist} = $hclass->new_from_dump($type, delete $struct->{hist});
  return bless($struct => $class);
}

# Can't simply be delegated, eventhough the implementation is the same :(
sub STORABLE_freeze {
  my $self = shift;
  my $cloning = shift;
  my $serialized = $self->dump('simple');
  return $serialized;
}



( run in 0.302 second using v1.01-cache-2.11-cpan-3b35f9de6a3 )