diff --git a/lib/Autom4te/C4che.pm b/lib/Autom4te/C4che.pm index 523f15bf..029138d1 100644 --- a/lib/Autom4te/C4che.pm +++ b/lib/Autom4te/C4che.pm @@ -155,13 +155,16 @@ Serialize all the current requests. sub marshall ($) { my ($caller) = @_; - my $res = ''; my $marshall = Data::Dumper->new ([\@request], [qw (*request)]); - $marshall->Indent(2)->Terse(0)->Sortkeys(1); - $res = $marshall->Dump . "\n"; + $marshall->Indent(2)->Terse(0); - return $res; + # The Sortkeys method was added in Data::Dumper 2.12_01, so it is + # available in 5.8.x and 5.6.2 but not in 5.6.1 or earlier. + # Ignore failure of method lookup. + eval { $marshall->Sortkeys(1); }; + + return $marshall->Dump . "\n"; } diff --git a/lib/Autom4te/Request.pm b/lib/Autom4te/Request.pm index 53f9ad7a..f4ede8df 100644 --- a/lib/Autom4te/Request.pm +++ b/lib/Autom4te/Request.pm @@ -59,14 +59,17 @@ struct sub marshall($) { my ($caller) = @_; - my $res = ''; # CALLER is an object: instance method. my $marshall = Data::Dumper->new ([$caller]); - $marshall->Indent(2)->Terse(0)->Sortkeys(1); - $res = $marshall->Dump . "\n"; + $marshall->Indent(2)->Terse(0); - return $res; + # The Sortkeys method was added in Data::Dumper 2.12_01, so it is + # available in 5.8.x and 5.6.2 but not in 5.6.1 or earlier. + # Ignore failure of method lookup. + eval { $marshall->Sortkeys(1); }; + + return $marshall->Dump . "\n"; }