Commit | Line | Data |
16dc9970 |
1 | package SQL::Translator::Parser; |
2 | |
16dc9970 |
3 | use strict; |
f27f9229 |
4 | use warnings; |
f769b7e8 |
5 | our $VERSION = '1.62'; |
16dc9970 |
6 | |
077ebf34 |
7 | sub parse { "" } |
16dc9970 |
8 | |
9 | 1; |
10 | |
49e1eb70 |
11 | # ---------------------------------------------------------------------- |
16dc9970 |
12 | # Enough! or Too much. |
13 | # William Blake |
49e1eb70 |
14 | # ---------------------------------------------------------------------- |
15 | |
16 | =pod |
16dc9970 |
17 | |
18 | =head1 NAME |
19 | |
b015e9ff |
20 | SQL::Translator::Parser - describes how to write a parser |
16dc9970 |
21 | |
16dc9970 |
22 | =head1 DESCRIPTION |
23 | |
8295a8cc |
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. |
16dc9970 |
30 | |
b015e9ff |
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: |
8295a8cc |
35 | |
b015e9ff |
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. |
8295a8cc |
42 | |
43 | =head1 AUTHORS |
44 | |
ea93df61 |
45 | Ken Youens-Clark, E<lt>kclark@cpan.org<gt>, |
49e1eb70 |
46 | darren chamberlain E<lt>darren@cpan.orgE<gt>. |
16dc9970 |
47 | |
48 | =head1 SEE ALSO |
49 | |
56435d6f |
50 | perl(1), SQL::Translator, SQL::Translator::Schema. |
16dc9970 |
51 | |
52 | =cut |