| 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 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 2 | our ($DEBUG, @EXPORT_OK); | |||||||||
| 27 | 2 | ▶ | $DEBUG = 0 unless defined $DEBUG; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 2 | our $VERSION = '1.66'; | |||||||||
| 29 | |||||||||||
| 30 | 2 | ▶ | use Storable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 2 | ▶ | use Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | 2 | ▶ | use base qw(Exporter); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | |||||||||||
| 34 | 2 | @EXPORT_OK = qw(produce); | |||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub produce { | ||||||||
|
Subroutine
produce: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | 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 | 2 | 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 | ||||||||||