5d8db98eb7acec73ce64a95ce3b40d52e53256ba
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / Storable.pm
1 package SQL::Translator::Producer::Storable;
2
3 # $Source: /home/faga/work/sqlfairy_svn/sqlfairy-cvsbackup/sqlfairy/lib/SQL/Translator/Producer/Storable.pm,v $
4 # $Id: Storable.pm,v 1.3 2003-10-08 22:55:10 kycl4rk Exp $
5
6 =head1 NAME
7
8 SQL::Translator::Producer::Storable - null producer for Schema objects that have already been created.
9
10 =head1 SYNOPSIS
11
12   use SQL::Translator;
13   use SQL::Translator::Producer::Storable;
14
15   my $translator = SQL::Translator->new;
16   $translator->producer("SQL::Translator::Producer::Storable");
17
18 =head1 DESCRIPTION
19
20 Uses Storable to serialize a schema to a string so that it can be
21 saved on disk or whatever.
22
23 =cut
24
25 use strict;
26 use vars qw($DEBUG $VERSION @EXPORT_OK);
27 $DEBUG = 0 unless defined $DEBUG;
28 $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/;
29
30 use Storable;
31 use Exporter;
32 use SQL::Translator::Utils qw(debug normalize_name);
33
34 use base qw(Exporter);
35
36 @EXPORT_OK = qw(produce);
37
38 sub produce {
39     my $t           = shift;
40
41     my $args        = $t->producer_args;
42     my $schema      = $t->schema;
43     my $serialized  = Storable::nfreeze($schema);
44
45     return $serialized;
46 }
47
48 1;
49
50 =pod
51
52 =head1 AUTHORS
53
54 Paul Harrington <harringp@deshaw.com>.
55
56 =head1 SEE ALSO
57
58 SQL::Translator.
59
60 =cut