package SQL::Translator;
# ----------------------------------------------------------------------
-# $Id: Translator.pm,v 1.53 2004-02-11 21:37:11 kycl4rk Exp $
+# $Id: Translator.pm,v 1.57 2004-04-22 19:59:46 kycl4rk Exp $
# ----------------------------------------------------------------------
# Copyright (C) 2002-4 The SQLFairy Authors
#
require 5.004;
-$VERSION = '0.05';
-$REVISION = sprintf "%d.%02d", q$Revision: 1.53 $ =~ /(\d+)\.(\d+)/;
+$VERSION = '0.06';
+$REVISION = sprintf "%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
$ERROR = "";
my @files = ref($filename) eq 'ARRAY' ? @$filename : ($filename);
foreach my $file (@files) {
- unless (open FH, $file) {
- return $self->error("Can't read file '$file': $!");
- }
+ unless (open FH, $file) {
+ return $self->error("Can't read file '$file': $!");
+ }
- $data .= <FH>;
+ $data .= <FH>;
- unless (close FH) {
- return $self->error("Can't close file '$file': $!");
- }
+ unless (close FH) {
+ return $self->error("Can't close file '$file': $!");
+ }
}
$self->{'data'} = \$data;
=head1 DESCRIPTION
+This documentation covers the API for SQL::Translator. For a more general
+discussion of how to use the modules and scripts, please see
+L<SQL::Translator::Manual>.
+
SQL::Translator is a group of Perl modules that converts
vendor-specific SQL table definitions into other formats, such as
other vendor-specific SQL, ER diagrams, documentation (POD and HTML),
SQL are handled (CREATE, ALTER), not the manipulation of data (INSERT,
UPDATE, DELETE).
-This documentation covers the API for SQL::Translator. For a more general
-discussion of how to use the modules and scripts, please see
-L<SQL::Translator::Manual>.
-
=head1 CONSTRUCTOR
The constructor is called C<new>, and accepts a optional hash of options.
The C<producer> method is an accessor/mutator, used to retrieve or
define what subroutine is called to produce the output. A subroutine
defined as a producer will be invoked as a function (I<not a method>)
-and passed 2 parameters: its container C<SQL::Translator> instance and a
-data structure. It is expected that the function transform the data
-structure to a string. The C<SQL::Transformer> instance is provided for
-informational purposes; for example, the type of the parser can be
+and passed its container C<SQL::Translator> instance, which it should
+call the C<schema> method on, to get the C<SQL::Translator::Schema>
+generated by the parser. It is expected that the function transform the
+schema structure to a string. The C<SQL::Translator> instance is also useful
+for informational purposes; for example, the type of the parser can be
retrieved using the C<parser_type> method, and the C<error> and
C<debug> methods can be called when needed.