« blib/lib/SQL/Translator/Producer/DiaUml.pm
↑ Summary
blib/lib/SQL/Translator/Producer/Storable.pm »
| 1 | package SQL::Translator::Parser; | ||
| 2 | |||
| 3 | 22 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 22 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 22 | our $VERSION = '1.66'; | |
| 6 | |||
| 7 | 0 | ▶ | sub parse {""} |
|
Subroutine
parse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 8 | |||
| 9 | 22 | 1; | |
| 10 | |||
| 11 | # ---------------------------------------------------------------------- | ||
| 12 | # Enough! or Too much. | ||
| 13 | # William Blake | ||
| 14 | # ---------------------------------------------------------------------- | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | SQL::Translator::Parser - describes how to write a parser | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | Parser modules that get invoked by SQL::Translator need to implement a | ||
| 25 | single function: B<parse>. This function will be called by the | ||
| 26 | SQL::Translator instance as $class::parse($tr, $data_as_string), where | ||
| 27 | $tr is a SQL::Translator instance. Other than that, the classes are | ||
| 28 | free to define any helper functions, or use any design pattern | ||
| 29 | internally that make the most sense. | ||
| 30 | |||
| 31 | When the parser has determined what exists, it will communicate the | ||
| 32 | structure to the producer through the SQL::Translator::Schema object. | ||
| 33 | This object can be retrieved from the translator (the first argument | ||
| 34 | pass to B<parse>) by calling the B<schema> method: | ||
| 35 | |||
| 36 | my $schema = $tr->schema; | ||
| 37 | |||
| 38 | The Schema object has methods for adding tables, fields, indices, etc. | ||
| 39 | For more information, consult the docs for SQL::Translator::Schema and | ||
| 40 | its related modules. For examples of how this works, examine the | ||
| 41 | source code for existing SQL::Translator::Parser::* modules. | ||
| 42 | |||
| 43 | =head1 AUTHORS | ||
| 44 | |||
| 45 | Ken Youens-Clark, E<lt>kclark@cpan.org<gt>, | ||
| 46 | darren chamberlain E<lt>darren@cpan.orgE<gt>. | ||
| 47 | |||
| 48 | =head1 SEE ALSO | ||
| 49 | |||
| 50 | perl(1), SQL::Translator, SQL::Translator::Schema. | ||
| 51 | |||
| 52 | =cut | ||