Release 0.11008
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator.pm
index 69787d8..cec3a07 100644 (file)
@@ -1,8 +1,6 @@
 package SQL::Translator;
 
 # ----------------------------------------------------------------------
-# $Id: Translator.pm 1448 2009-02-07 18:32:52Z ribasushi $
-# ----------------------------------------------------------------------
 # Copyright (C) 2002-2009 The SQLFairy Authors
 #
 # This program is free software; you can redistribute it and/or
@@ -24,16 +22,15 @@ use strict;
 use vars qw( $VERSION $DEFAULT_SUB $DEBUG $ERROR );
 use base 'Class::Base';
 
-require 5.004;
+require 5.005;
 
-$VERSION  = '0.09003';
+$VERSION  = '0.11008';
 $DEBUG    = 0 unless defined $DEBUG;
 $ERROR    = "";
 
 use Carp qw(carp);
 
 use Data::Dumper;
-use Class::Base;
 use File::Find;
 use File::Spec::Functions qw(catfile);
 use File::Basename qw(dirname);
@@ -125,10 +122,10 @@ sub init {
     $self->trace( $config->{'trace'} );
 
     $self->validate( $config->{'validate'} );
-    
-    $self->quote_table_names( (defined $config->{'quote_table_names'} 
+
+    $self->quote_table_names( (defined $config->{'quote_table_names'}
         ? $config->{'quote_table_names'} : 1) );
-    $self->quote_field_names( (defined $config->{'quote_field_names'} 
+    $self->quote_field_names( (defined $config->{'quote_field_names'}
         ? $config->{'quote_field_names'} : 1) );
 
     return $self;
@@ -321,6 +318,7 @@ sub data {
                 $data = join '', @$data;
             }
             elsif (isa($data, 'GLOB')) {
+                seek ($data, 0, 0) if eof ($data);
                 local $/;
                 $data = <$data>;
             }
@@ -623,8 +621,8 @@ sub _args {
 
 # ----------------------------------------------------------------------
 # Does the get/set work for parser and producer. e.g.
-# return $self->_tool({ 
-#   name => 'producer', 
+# return $self->_tool({
+#   name => 'producer',
 #   path => "SQL::Translator::Producer",
 #   default_sub => "produce",
 # }, @_);
@@ -637,7 +635,7 @@ sub _tool {
     my $path = $args->{path};
     my $default_sub = $args->{default_sub};
     my $tool = shift;
-   
+
     # passed an anonymous subroutine reference
     if (isa($tool, 'CODE')) {
         $self->{$name} = $tool;
@@ -691,7 +689,7 @@ sub _list {
     my $uctype = ucfirst lc $type;
 
     #
-    # First find all the directories where SQL::Translator 
+    # First find all the directories where SQL::Translator
     # parsers or producers (the "type") appear to live.
     #
     load("SQL::Translator::$uctype") or return ();
@@ -705,13 +703,13 @@ sub _list {
     }
 
     #
-    # Now use File::File::find to look recursively in those 
+    # Now use File::File::find to look recursively in those
     # directories for all the *.pm files, then present them
     # with the slashes turned into dashes.
     #
     my %found;
-    find( 
-        sub { 
+    find(
+        sub {
             if ( -f && m/\.pm$/ ) {
                 my $mod      =  $_;
                    $mod      =~ s/\.pm$//;
@@ -768,7 +766,7 @@ sub load {
         return $module if $INC{$file}; # Already loaded
 
         eval { require $file };
-        next if $@ =~ /Can't locate $file in \@INC/; 
+        next if $@ =~ /Can't locate $file in \@INC/;
         eval { $module->import() } unless $@;
         return __PACKAGE__->error("Error loading $name as $module : $@")
         if $@ && $@ !~ /"SQL::Translator::Producer" is not exported/;
@@ -1011,7 +1009,7 @@ advantage is gained by passing options to the constructor.
 
 =head2 add_drop_table
 
-Toggles whether or not to add "DROP TABLE" statements just before the 
+Toggles whether or not to add "DROP TABLE" statements just before the
 create definitions.
 
 =head2 quote_table_names
@@ -1035,9 +1033,9 @@ 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 its container C<SQL::Translator> instance, which it should
-call the C<schema> method on, to get the C<SQL::Translator::Schema> 
+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 
+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.
@@ -1270,47 +1268,8 @@ Returns the version of the SQL::Translator release.
 
 =head1 AUTHORS
 
-The following people have contributed to the SQLFairy project:
-
-=over 4
-
-=item * Mark Addison <grommit@users.sourceforge.net>
-
-=item * Sam Angiuoli <angiuoli@users.sourceforge.net>
-
-=item * Anders Nor Berle <berle@cpan.org>
-
-=item * Dave Cash <dave@gnofn.org>
-
-=item * Darren Chamberlain <dlc@users.sourceforge.net>
-
-=item * Ken Y. Clark <kclark@cpan.org>
-
-=item * Allen Day <allenday@users.sourceforge.net>
-
-=item * Paul Harrington <phrrngtn@users.sourceforge.net>
-
-=item * Mikey Melillo <mmelillo@users.sourceforge.net>
-
-=item * Chris Mungall <cjm@fruitfly.org>
-
-=item * Ross Smith II <rossta@users.sf.net>
-
-=item * Gudmundur A. Thorisson <mummi@cshl.org>
-
-=item * Chris To <christot@users.sourceforge.net>
-
-=item * Jason Williams <smdwilliams@users.sourceforge.net>
-
-=item * Ying Zhang <zyolive@yahoo.com>
-
-=item * Daniel Ruoso <daniel@ruoso.com>
-
-=item * Ryan D Johnson <ryan@innerfence.com>
-
-=item * Jonathan Yu <frequency@cpan.org>
-
-=back
+See the included AUTHORS file:
+L<http://search.cpan.org/dist/SQL-Translator/AUTHORS>
 
 If you would like to contribute to the project, you can send patches
 to the developers mailing list:
@@ -1343,7 +1302,7 @@ Please use L<http://rt.cpan.org/> for reporting bugs.
 
 =head1 PRAISE
 
-If you find this module useful, please use 
+If you find this module useful, please use
 L<http://cpanratings.perl.org/rate/?distribution=SQL-Translator> to rate it.
 
 =head1 SEE ALSO