From: Paul Harrington Date: Wed, 8 Oct 2003 20:35:52 +0000 (+0000) Subject: still a bit hacky .. would like to use a method that will work on either "store"... X-Git-Tag: v0.04~105 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca0022de42ada319b27fac192e01e40a94747a9b;p=dbsrgits%2FSQL-Translator.git still a bit hacky .. would like to use a method that will work on either "store" or "freeze" data. This will still break if you are passed in a file that contains the result of a freeze --- diff --git a/lib/SQL/Translator/Parser/Storable.pm b/lib/SQL/Translator/Parser/Storable.pm index 1992e49..ef22e86 100755 --- a/lib/SQL/Translator/Parser/Storable.pm +++ b/lib/SQL/Translator/Parser/Storable.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::Storable; # $Source: /home/faga/work/sqlfairy_svn/sqlfairy-cvsbackup/sqlfairy/lib/SQL/Translator/Parser/Storable.pm,v $ -# $Id: Storable.pm,v 1.1 2003-10-08 18:24:25 phrrngtn Exp $ +# $Id: Storable.pm,v 1.2 2003-10-08 20:35:52 phrrngtn Exp $ =head1 NAME @@ -25,7 +25,7 @@ the data into a database tables or graphs. use strict; use vars qw($DEBUG $VERSION @EXPORT_OK); $DEBUG = 0 unless defined $DEBUG; -$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/; use Storable; use Exporter; @@ -38,13 +38,15 @@ use base qw(Exporter); sub parse { my ($translator, $data) = @_; - $translator->{'schema'} = Storable::thaw($data) - if defined($data); + if (defined($data)) { + $translator->{'schema'} = Storable::thaw($data); + return 1; + } elsif (defined($translator->filename)) { + $translator->{'schema'} = Storable::retrieve($translator->filename); + return 1; + } - $translator->{'schema'} = Storable::retrieve($translator->filename) - if defined($translator->filename); - - return 1; + return 0; } 1;