| 1 | # Copyright 2011-2026, Paul Johnson (paul@pjcj.net) | ||
| 2 | |||
| 3 | # This software is free. It is licensed under the same terms as Perl itself. | ||
| 4 | |||
| 5 | # The latest version of this software should be available from my homepage: | ||
| 6 | # https://pjcj.net | ||
| 7 | |||
| 8 | package Devel::Cover::DB::IO::Storable; | ||
| 9 | |||
| 10 | use strict; | ||
| 11 | use warnings; | ||
| 12 | |||
| 13 | use base "Devel::Cover::DB::IO::Base"; | ||
| 14 | |||
| 15 | use Storable; | ||
| 16 | |||
| 17 | our $VERSION = '1.52'; # VERSION | ||
| 18 | |||
| 19 | sub new { | ||
| 20 | my $class = shift; | ||
| 21 | my $self = $class->SUPER::new(@_); | ||
| 22 | bless $self, $class | ||
| 23 | } | ||
| 24 | |||
| 25 | sub read { | ||
| 26 | my $self = shift; | ||
| 27 | my ($file) = @_; | ||
| 28 | $self->_read($file, sub { Storable::retrieve($file) }) | ||
| 29 | } | ||
| 30 | |||
| 31 | sub write { | ||
| 32 | my $self = shift; | ||
| 33 | my ($data, $file) = @_; | ||
| 34 | $self->_write($file, sub { Storable::nstore($data, $file) }) | ||
| 35 | } | ||
| 36 | |||
| 37 | 1 | ||
| 38 | |||
| 39 | __END__ |