File Coverage

blib/lib/SQL/Translator/Producer/Storable.pm
Criterion Covered Total %
statement 15 20 75.0
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 27 74.0


line stmt bran cond sub pod time code
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 2     2   2710 use strict;
  2         5  
  2         57  
25 2     2   11 use warnings;
  2         4  
  2         129  
26             our ( $DEBUG, @EXPORT_OK );
27             $DEBUG = 0 unless defined $DEBUG;
28             our $VERSION = '1.63';
29              
30 2     2   35 use Storable;
  2         6  
  2         119  
31 2     2   11 use Exporter;
  2         8  
  2         91  
32 2     2   12 use base qw(Exporter);
  2         4  
  2         382  
33              
34             @EXPORT_OK = qw(produce);
35              
36             sub produce {
37 0     0 0   my $t = shift;
38 0           my $args = $t->producer_args;
39 0           my $schema = $t->schema;
40 0           my $serialized = Storable::nfreeze($schema);
41              
42 0           return $serialized;
43             }
44              
45             1;
46              
47             =pod
48              
49             =head1 AUTHOR
50              
51             Paul Harrington Eharringp@deshaw.comE.
52              
53             =head1 SEE ALSO
54              
55             SQL::Translator, SQL::Translator::Schema, Storable.
56              
57             =cut