1 package SQL::Translator::Parser;
3 # ----------------------------------------------------------------------
4 # $Id: Parser.pm,v 1.8 2003-08-22 22:51:51 kycl4rk Exp $
5 # ----------------------------------------------------------------------
6 # Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
7 # darren chamberlain <darren@cpan.org>,
8 # Chris Mungall <cjm@fruitfly.org>.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation; version 2.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # ----------------------------------------------------------------------
26 use vars qw( $VERSION );
27 $VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/;
33 # ----------------------------------------------------------------------
34 # Enough! or Too much.
36 # ----------------------------------------------------------------------
42 SQL::Translator::Parser - describes how to write a parser
46 Parser modules that get invoked by SQL::Translator need to implement a
47 single function: B<parse>. This function will be called by the
48 SQL::Translator instance as $class::parse($tr, $data_as_string), where
49 $tr is a SQL::Translator instance. Other than that, the classes are
50 free to define any helper functions, or use any design pattern
51 internally that make the most sense.
53 When the parser has determined what exists, it will communicate the
54 structure to the producer through the SQL::Translator::Schema object.
55 This object can be retrieved from the translator (the first argument
56 pass to B<parse>) by calling the B<schema> method:
58 my $schema = $tr->schema;
60 The Schema object has methods for adding tables, fields, indices, etc.
61 For more information, consult the docs for SQL::Translator::Schema and
62 its related modules. For examples of how this works, examine the
63 source code for existing SQL::Translator::Parser::* modules.
67 Ken Y. Clark, E<lt>kclark@cpan.org<gt>,
68 darren chamberlain E<lt>darren@cpan.orgE<gt>.
72 perl(1), SQL::Translator, SQL::Translator::Schema.