Release commit for 1.62
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / Storable.pm
1 package SQL::Translator::Producer::Storable;
2
3 =head1 NAME
4
5 SQL::Translator::Producer::Storable - serializes the SQL::Translator::Schema
6     object via the Storable module
7
8 =head1 SYNOPSIS
9
10   use SQL::Translator;
11
12   my $translator = SQL::Translator->new;
13   $translator->producer('Storable');
14
15 =head1 DESCRIPTION
16
17 This module uses Storable to serialize a schema to a string so that it
18 can be saved to disk.  Serializing a schema and then calling producers
19 on the stored can realize significant performance gains when parsing
20 takes a long time.
21
22 =cut
23
24 use strict;
25 use warnings;
26 our ( $DEBUG, @EXPORT_OK );
27 $DEBUG = 0 unless defined $DEBUG;
28 our $VERSION = '1.62';
29
30 use Storable;
31 use Exporter;
32 use base qw(Exporter);
33
34 @EXPORT_OK = qw(produce);
35
36 sub produce {
37     my $t           = shift;
38     my $args        = $t->producer_args;
39     my $schema      = $t->schema;
40     my $serialized  = Storable::nfreeze($schema);
41
42     return $serialized;
43 }
44
45 1;
46
47 =pod
48
49 =head1 AUTHOR
50
51 Paul Harrington E<lt>harringp@deshaw.comE<gt>.
52
53 =head1 SEE ALSO
54
55 SQL::Translator, SQL::Translator::Schema, Storable.
56
57 =cut