Commit | Line | Data |
16dc9970 |
1 | package SQL::Translator::Parser; |
2 | |
077ebf34 |
3 | # ---------------------------------------------------------------------- |
977651a5 |
4 | # $Id: Parser.pm,v 1.9 2004-02-09 23:04:26 kycl4rk Exp $ |
077ebf34 |
5 | # ---------------------------------------------------------------------- |
977651a5 |
6 | # Copyright (C) 2002-4 SQLFairy Authors |
16dc9970 |
7 | # |
077ebf34 |
8 | # This program is free software; you can redistribute it and/or |
9 | # modify it under the terms of the GNU General Public License as |
10 | # published by the Free Software Foundation; version 2. |
11 | # |
12 | # This program is distributed in the hope that it will be useful, but |
13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | # General Public License for more details. |
16 | # |
17 | # You should have received a copy of the GNU General Public License |
18 | # along with this program; if not, write to the Free Software |
19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
20 | # 02111-1307 USA |
21 | # ---------------------------------------------------------------------- |
16dc9970 |
22 | |
23 | use strict; |
24 | use vars qw( $VERSION ); |
977651a5 |
25 | $VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; |
16dc9970 |
26 | |
077ebf34 |
27 | sub parse { "" } |
16dc9970 |
28 | |
29 | 1; |
30 | |
49e1eb70 |
31 | # ---------------------------------------------------------------------- |
16dc9970 |
32 | # Enough! or Too much. |
33 | # William Blake |
49e1eb70 |
34 | # ---------------------------------------------------------------------- |
35 | |
36 | =pod |
16dc9970 |
37 | |
38 | =head1 NAME |
39 | |
b015e9ff |
40 | SQL::Translator::Parser - describes how to write a parser |
16dc9970 |
41 | |
16dc9970 |
42 | =head1 DESCRIPTION |
43 | |
8295a8cc |
44 | Parser modules that get invoked by SQL::Translator need to implement a |
45 | single function: B<parse>. This function will be called by the |
46 | SQL::Translator instance as $class::parse($tr, $data_as_string), where |
47 | $tr is a SQL::Translator instance. Other than that, the classes are |
48 | free to define any helper functions, or use any design pattern |
49 | internally that make the most sense. |
16dc9970 |
50 | |
b015e9ff |
51 | When the parser has determined what exists, it will communicate the |
52 | structure to the producer through the SQL::Translator::Schema object. |
53 | This object can be retrieved from the translator (the first argument |
54 | pass to B<parse>) by calling the B<schema> method: |
8295a8cc |
55 | |
b015e9ff |
56 | my $schema = $tr->schema; |
57 | |
58 | The Schema object has methods for adding tables, fields, indices, etc. |
59 | For more information, consult the docs for SQL::Translator::Schema and |
60 | its related modules. For examples of how this works, examine the |
61 | source code for existing SQL::Translator::Parser::* modules. |
8295a8cc |
62 | |
63 | =head1 AUTHORS |
64 | |
d529894e |
65 | Ken Y. Clark, E<lt>kclark@cpan.org<gt>, |
49e1eb70 |
66 | darren chamberlain E<lt>darren@cpan.orgE<gt>. |
16dc9970 |
67 | |
68 | =head1 SEE ALSO |
69 | |
56435d6f |
70 | perl(1), SQL::Translator, SQL::Translator::Schema. |
16dc9970 |
71 | |
72 | =cut |