1 package SQL::Translator::Parser;
3 # ----------------------------------------------------------------------
4 # $Id: Parser.pm,v 1.9 2004-02-09 23:04:26 kycl4rk Exp $
5 # ----------------------------------------------------------------------
6 # Copyright (C) 2002-4 SQLFairy Authors
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.
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.
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
21 # ----------------------------------------------------------------------
24 use vars qw( $VERSION );
25 $VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/;
31 # ----------------------------------------------------------------------
32 # Enough! or Too much.
34 # ----------------------------------------------------------------------
40 SQL::Translator::Parser - describes how to write a parser
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.
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:
56 my $schema = $tr->schema;
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.
65 Ken Y. Clark, E<lt>kclark@cpan.org<gt>,
66 darren chamberlain E<lt>darren@cpan.orgE<gt>.
70 perl(1), SQL::Translator, SQL::Translator::Schema.