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.5 2004-02-09 22:23:40 kycl4rk Exp $
+# -------------------------------------------------------------------
+# Copyright (C) 2002-4 SQLFairy Authors
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA
+# -------------------------------------------------------------------
=head1 NAME
-SQL::Translator::Parser::Storable - null parser for Schema objects that have already been created.
+SQL::Translator::Parser::Storable - parser for Schema objects serialized
+ with the Storable module
=head1 SYNOPSIS
use SQL::Translator;
- use SQL::Translator::Parser::Storable;
my $translator = SQL::Translator->new;
- $translator->parser("SQL::Translator::Parser::Storable");
+ $translator->parser('Storable');
=head1 DESCRIPTION
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.5 $ =~ /(\d+)\.(\d+)/;
use Storable;
use 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;
+# -------------------------------------------------------------------
+
=pod
=head1 SEE ALSO
-SQL::Translator::Parser::Excel;
+SQL::Translator.
-=head1 AUTHORS
+=head1 AUTHOR
-Paul Harrington <harringp@deshaw.com>
+Paul Harrington E<lt>harringp@deshaw.comE<gt>.
=cut