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