Commit | Line | Data |
---|---|---|
f6595170 | 1 | package SQL::Translator::Producer::Storable; |
2 | ||
f6595170 | 3 | =head1 NAME |
4 | ||
4fc11ff6 | 5 | SQL::Translator::Producer::Storable - serializes the SQL::Translator::Schema |
6 | object via the Storable module | |
f6595170 | 7 | |
8 | =head1 SYNOPSIS | |
9 | ||
10 | use SQL::Translator; | |
f6595170 | 11 | |
12 | my $translator = SQL::Translator->new; | |
4fc11ff6 | 13 | $translator->producer('Storable'); |
f6595170 | 14 | |
15 | =head1 DESCRIPTION | |
16 | ||
4fc11ff6 | 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. | |
f6595170 | 21 | |
22 | =cut | |
23 | ||
24 | use strict; | |
da06ac74 | 25 | use vars qw($DEBUG $VERSION @EXPORT_OK); |
f6595170 | 26 | $DEBUG = 0 unless defined $DEBUG; |
11ad2df9 | 27 | $VERSION = '1.59'; |
f6595170 | 28 | |
29 | use Storable; | |
30 | use Exporter; | |
f6595170 | 31 | use base qw(Exporter); |
32 | ||
33 | @EXPORT_OK = qw(produce); | |
34 | ||
35 | sub produce { | |
36 | my $t = shift; | |
f6595170 | 37 | my $args = $t->producer_args; |
38 | my $schema = $t->schema; | |
349af114 | 39 | my $serialized = Storable::nfreeze($schema); |
f6595170 | 40 | |
41 | return $serialized; | |
42 | } | |
43 | ||
44 | 1; | |
45 | ||
4fc11ff6 | 46 | # ------------------------------------------------------------------- |
47 | ||
f6595170 | 48 | =pod |
49 | ||
4fc11ff6 | 50 | =head1 AUTHOR |
f6595170 | 51 | |
4fc11ff6 | 52 | Paul Harrington E<lt>harringp@deshaw.comE<gt>. |
f6595170 | 53 | |
54 | =head1 SEE ALSO | |
55 | ||
4fc11ff6 | 56 | SQL::Translator, SQL::Translator::Schema, Storable. |
f6595170 | 57 | |
58 | =cut |