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