summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Písař <ppisar@redhat.com>2017-05-03 16:57:52 +0200
committergregor herrmann <gregoa@debian.org>2021-10-15 18:00:27 +0200
commit394aa96eff9e253cfa5dd9f6cc537aa758601796 (patch)
treea8207b09ea4368a540628f3065c7af9e13b9540a
parent31826c9dc76b5b1ffd44cce8ef557cc1d6d34aa9 (diff)
[PATCH] Adapt to changes in Cache-FastMmap-1.45HEADarchive/debian/0.61-1master
Cache-FastMmap-1.45 deprecated raw_values constructor argument in favor of new serializer argument. This changes caused t/smoke-Driver-CacheCache.t to fail. This patch uses serializer with Cache::FastMmap >= 1.45, otherwise the old raw_values. CPAN RT#120705 Signed-off-by: Petr Písař <ppisar@redhat.com> Bug-Debian: https://bugs.debian.org/870235 Gbp-Pq: Name 0001-Adapt-to-changes-in-Cache-FastMmap-1.45.patch
-rw-r--r--lib/CHI/Driver/FastMmap.pm10
-rw-r--r--lib/CHI/t/Driver/FastMmap.pm6
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/CHI/Driver/FastMmap.pm b/lib/CHI/Driver/FastMmap.pm
index 78990c6..a688e2a 100644
--- a/lib/CHI/Driver/FastMmap.pm
+++ b/lib/CHI/Driver/FastMmap.pm
@@ -21,7 +21,11 @@ sub BUILD {
mkpath( $self->root_dir, 0, $self->dir_create_mode )
if !-d $self->root_dir;
$self->{fm_params} = {
- raw_values => 1,
+ (
+ ($Cache::FastMmap::VERSION >= 1.45) ?
+ (serializer => '') :
+ (raw_values => 1)
+ ),
unlink_on_exit => 0,
share_file => catfile(
$self->root_dir,
@@ -107,8 +111,8 @@ though not between hosts.
To support namespaces, this driver takes a directory parameter rather than a
file, and creates one Cache::FastMMap file for each namespace.
-Because CHI handles serialization automatically, we pass the C<raw_values> flag
-as 1; and to conform to the CHI API, we pass C<unlink_on_exit> as 0, so that
+Because CHI handles serialization automatically, we pass the C<serializer> flag
+as ''; and to conform to the CHI API, we pass C<unlink_on_exit> as 0, so that
all cache files are permanent.
=head1 REQUIREMENTS
diff --git a/lib/CHI/t/Driver/FastMmap.pm b/lib/CHI/t/Driver/FastMmap.pm
index de92912..7c7841e 100644
--- a/lib/CHI/t/Driver/FastMmap.pm
+++ b/lib/CHI/t/Driver/FastMmap.pm
@@ -35,7 +35,11 @@ sub test_fm_cache : Tests {
my %defaults = (
unlink_on_exit => 0,
empty_on_exit => 0,
- raw_values => 1,
+ (
+ ($Cache::FastMmap::VERSION >= 1.45) ?
+ (serialize => 0) :
+ (raw_values => 1)
+ ),
);
while ( my ( $key, $value ) = each(%defaults) ) {
is( $fm_cache->{$key} || 0, $value, "$key = $value by default" );