Upped version numbers, cleaned up code, fixed my name.
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / Storable.pm
CommitLineData
f6595170 1package SQL::Translator::Producer::Storable;
2
4fc11ff6 3# -------------------------------------------------------------------
478f608d 4# Copyright (C) 2002-2009 SQLFairy Authors
4fc11ff6 5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License as
8# published by the Free Software Foundation; version 2.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18# 02111-1307 USA
19# -------------------------------------------------------------------
f6595170 20=head1 NAME
21
4fc11ff6 22SQL::Translator::Producer::Storable - serializes the SQL::Translator::Schema
23 object via the Storable module
f6595170 24
25=head1 SYNOPSIS
26
27 use SQL::Translator;
f6595170 28
29 my $translator = SQL::Translator->new;
4fc11ff6 30 $translator->producer('Storable');
f6595170 31
32=head1 DESCRIPTION
33
4fc11ff6 34This module uses Storable to serialize a schema to a string so that it
35can be saved to disk. Serializing a schema and then calling producers
36on the stored can realize significant performance gains when parsing
37takes a long time.
f6595170 38
39=cut
40
41use strict;
da06ac74 42use vars qw($DEBUG $VERSION @EXPORT_OK);
f6595170 43$DEBUG = 0 unless defined $DEBUG;
ba506e52 44$VERSION = '1.60';
f6595170 45
46use Storable;
47use Exporter;
f6595170 48use base qw(Exporter);
49
50@EXPORT_OK = qw(produce);
51
52sub produce {
53 my $t = shift;
f6595170 54 my $args = $t->producer_args;
55 my $schema = $t->schema;
349af114 56 my $serialized = Storable::nfreeze($schema);
f6595170 57
58 return $serialized;
59}
60
611;
62
4fc11ff6 63# -------------------------------------------------------------------
64
f6595170 65=pod
66
4fc11ff6 67=head1 AUTHOR
f6595170 68
4fc11ff6 69Paul Harrington E<lt>harringp@deshaw.comE<gt>.
f6595170 70
71=head1 SEE ALSO
72
4fc11ff6 73SQL::Translator, SQL::Translator::Schema, Storable.
f6595170 74
75=cut