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
|
|
2579
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
25
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
113
|
|
26
|
|
|
|
|
|
|
our ( $DEBUG, @EXPORT_OK ); |
27
|
|
|
|
|
|
|
$DEBUG = 0 unless defined $DEBUG; |
28
|
|
|
|
|
|
|
our $VERSION = '1.6_3'; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
|
28
|
use Storable; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
104
|
|
31
|
2
|
|
|
2
|
|
13
|
use Exporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
32
|
2
|
|
|
2
|
|
11
|
use base qw(Exporter); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
327
|
|
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 |