[gimp-perl] Gimp::Data doc update.
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Gimp::Data doc update.
- Date: Mon, 26 May 2014 05:28:17 +0000 (UTC)
commit afaf657585a6d6b4651272bc17c0c2b9ebb11a59
Author: Ed J <edj src gnome org>
Date: Mon May 26 06:25:11 2014 +0100
Gimp::Data doc update.
Gimp/Data.pm | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/Gimp/Data.pm b/Gimp/Data.pm
index 586c59d..05d4b58 100644
--- a/Gimp/Data.pm
+++ b/Gimp/Data.pm
@@ -5,16 +5,18 @@ use warnings;
sub freeze($) {
my $data = shift;
- return $data unless ref $data;
+ return $data unless ref $data or _looks_frozen($data);
require Data::Dumper;
$data = Data::Dumper->new([$data]);
$data->Purity(1)->Terse(0);
return $data->Dump;
}
+sub _looks_frozen { shift =~ /^\$VAR1 =/; }
+
sub thaw {
my $data = shift;
- if ($data =~ /^\$VAR1 =/) {
+ if (_looks_frozen($data)) {
my $VAR1;
no warnings;
return eval $data;
@@ -81,7 +83,7 @@ like your plug-in's name. As an example, the Gimp::Fu module uses
As of L<Gimp> version 2.3 (and GIMP 2.8), your data B<will> survive a
restart of the Gimp application.
-C<Gimp::Data> will try to freeze your data when you pass in a reference. On
+C<Gimp::Data> will freeze your data when you pass in a reference. On
retrieval, the data is thawed again. See L<Data::Dumper> for more info.
=head1 PERSISTENCE
@@ -103,8 +105,8 @@ Thaw (unserialize) the dsata and return the original reference.
=head1 LIMITATIONS
-You cannot store references, and you cannot (yet) iterate through the keys
-(with C<keys>, C<values> or C<each>).
+You cannot (yet) iterate through the keys (with C<keys>, C<values>
+or C<each>).
=head1 AUTHOR
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]