*** empty log message ***

This commit is contained in:
Marc Lehmann 2001-08-05 18:12:13 +00:00
parent fdabe08cf0
commit 572942f1da
2 changed files with 28 additions and 26 deletions

View File

@ -10,7 +10,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD %EXPORT_TAGS @EXPORT_FAIL
use subs qw(init end lock unlock canonicalize_color);
BEGIN {
$VERSION = 1.21;
$VERSION = 1.201;
eval {
require XSLoader;
XSLoader::load Gimp $VERSION;
@ -244,16 +244,14 @@ sub canonicalize_colour {
[map {eval "0x$_"} ($1,$2,$3)];
} else {
unless (%rgb_db) {
local *RGB_TEXT;
if ($rgb_db_path) {
open RGB_TEXT, "<$rgb_db_path" or croak __"unable to open $rgb_db_path";
open RGB_TEXT,"<$rgb_db_path" or croak __"unable to open $rgb_db_path";
} else {
*RGB_TEXT = *DATA;
seek RGB_TEXT, 0, 0;
*RGB_TEXT=*DATA;
}
while(<RGB_TEXT>) {
next unless /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(.+?)\s*$/;
$rgb_db{lc($4)} = [$1,$2,$3];
$rgb_db{lc($4)}=[$1,$2,$3];
}
close RGB_TEXT;
}
@ -610,7 +608,6 @@ sub new($$$$) { shift; [@_] }
package Gimp::run_mode;
# I guess I now use almost every perl feature available ;)
# [except pseudo hashes. pseudo hashes must die!]
use overload fallback => 1,
'0+' => sub { ${$_[0]} };

View File

@ -2,18 +2,31 @@ package Gimp::Data;
sub freeze($) {
my $data = shift;
eval { require Data::Dumper } or return;
$data = new Data::Dumper [$data];
$data->Purity(1)->Terse(0);
$data = $data->Dump;
if (ref $data
or $data =~ /^\$VAR1 = \[/) {
if ( eval { require Data::Dumper } ) {
$data = new Data::Dumper [$data];
$data->Purity(1)->Terse(0);
return $data->Dump;
} else {
return;
}
}
$data;
}
sub thaw {
my $data = shift;
eval { require Data::Dumper } or return;
my $VAR1; # Data::Dumper is braindamaged
local $^W=0; # perl -w is braindamaged
eval $data;
if ($data =~ /^\$VAR1 = \[/) {
if (eval { require Data::Dumper }) {
my $VAR1; # Data::Dumper is braindamaged
local $^W=0; # perl -w is braindamaged
return eval $data;
} else {
return;
}
}
$data;
}
sub TIEHASH {
@ -24,20 +37,12 @@ sub TIEHASH {
}
sub FETCH {
my $data = eval { Gimp->parasite_find ($_[1])->data }
|| ($@ ? Gimp->get_data ($_[1]) : ());
if ($data =~ /^\$VAR1 = \[/) {
thaw $data;
} else {
$data;
}
thaw eval { Gimp->parasite_find ($_[1])->data }
|| ($@ ? Gimp->get_data ($_[1]) : ());
}
sub STORE {
my $data = $_[2];
if (ref $data) {
$data = freeze $data or return;
}
my $data = freeze $_[2];
eval { Gimp->parasite_attach ([$_[1], Gimp::PARASITE_PERSISTENT, $data]) };
Gimp->set_data ($_[1], $data) if $@;
}