| 1 | package SQL::Translator::Parser::Storable; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | =head1 NAME | ||||||||||||||
| 4 | |||||||||||||||
| 5 | SQL::Translator::Parser::Storable - parser for Schema objects serialized | ||||||||||||||
| 6 | with the Storable module | ||||||||||||||
| 7 | |||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||
| 9 | |||||||||||||||
| 10 | use SQL::Translator; | ||||||||||||||
| 11 | |||||||||||||||
| 12 | my $translator = SQL::Translator->new; | ||||||||||||||
| 13 | $translator->parser('Storable'); | ||||||||||||||
| 14 | |||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||
| 16 | |||||||||||||||
| 17 | Slurps in a Schema from a Storable file on disk. You can then turn | ||||||||||||||
| 18 | the data into a database tables or graphs. | ||||||||||||||
| 19 | |||||||||||||||
| 20 | =cut | ||||||||||||||
| 21 | |||||||||||||||
| 22 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 23 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 24 | 2 | our $VERSION = '1.66'; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 2 | our $DEBUG; | |||||||||||||
| 27 | 2 | ▶ | $DEBUG = 0 unless defined $DEBUG; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | |||||||||||||||
| 29 | 2 | ▶ | use Storable; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 30 | 2 | ▶ | use SQL::Translator::Utils qw(debug normalize_name); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 31 | |||||||||||||||
| 32 | 2 | ▶ | use base qw(Exporter); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 33 | 2 | our @EXPORT_OK = qw(parse); | |||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | ▶ | sub parse { | ||||||||||||
|
Subroutine
parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 36 | 0 | my ($translator, $data) = @_; | |||||||||||||
| 37 | |||||||||||||||
| 38 | 0 | ▶ | if (defined($data)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 39 | 0 | $translator->{'schema'} = Storable::thaw($data); | |||||||||||||
| 40 | 0 | return 1; | |||||||||||||
| 41 | } elsif (defined($translator->filename)) { | ||||||||||||||
| 42 | 0 | $translator->{'schema'} = Storable::retrieve($translator->filename); | |||||||||||||
| 43 | 0 | return 1; | |||||||||||||
| 44 | } | ||||||||||||||
| 45 | |||||||||||||||
| 46 | 0 | return 0; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 2 | 1; | |||||||||||||
| 50 | |||||||||||||||
| 51 | =pod | ||||||||||||||
| 52 | |||||||||||||||
| 53 | =head1 SEE ALSO | ||||||||||||||
| 54 | |||||||||||||||
| 55 | SQL::Translator. | ||||||||||||||
| 56 | |||||||||||||||
| 57 | =head1 AUTHOR | ||||||||||||||
| 58 | |||||||||||||||
| 59 | Paul Harrington E<lt>harringp@deshaw.comE<gt>. | ||||||||||||||
| 60 | |||||||||||||||
| 61 | =cut | ||||||||||||||