[gimp-perl] More delocalising numbers stored in Gimp::Data.



commit 0e31fef708d4519023317c665c553df82f36c9d5
Author: Ed J <edj src gnome org>
Date:   Mon Jun 9 00:51:45 2014 +0100

    More delocalising numbers stored in Gimp::Data.

 Gimp/Data.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/Gimp/Data.pm b/Gimp/Data.pm
index 5f22771..eee6d22 100644
--- a/Gimp/Data.pm
+++ b/Gimp/Data.pm
@@ -2,14 +2,18 @@ package Gimp::Data;
 
 use strict;
 use warnings;
+use POSIX qw(locale_h);
 
 sub freeze($) {
    my $data = shift;
    return $data unless ref $data or _looks_frozen($data);
    require Data::Dumper;
+   my $locale = setlocale(LC_NUMERIC); setlocale(LC_NUMERIC, "C");
    $data = Data::Dumper->new([$data]);
    $data->Purity(1)->Terse(0);
-   return $data->Dump;
+   my $frozen = $data->Dump;
+   setlocale(LC_NUMERIC, $locale);
+   return $frozen;
 }
 
 sub _looks_frozen { shift =~ /^\$VAR1 =/; }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]