From: Ken Youens-Clark Date: Thu, 24 Apr 2003 16:15:58 +0000 (+0000) Subject: Cosmetic changes to keep the coding style consistent. X-Git-Tag: v0.02~176 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9a0c3b53a1dbd9c5d9b98cfbef54af5c2ade730;p=dbsrgits%2FSQL-Translator.git Cosmetic changes to keep the coding style consistent. --- diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm index 31d9859..0687532 100644 --- a/lib/SQL/Translator.pm +++ b/lib/SQL/Translator.pm @@ -1,7 +1,7 @@ package SQL::Translator; # ---------------------------------------------------------------------- -# $Id: Translator.pm,v 1.23 2003-04-19 23:32:34 allenday Exp $ +# $Id: Translator.pm,v 1.24 2003-04-24 16:15:58 kycl4rk Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -27,7 +27,7 @@ use vars qw( $VERSION $REVISION $DEFAULT_SUB $DEBUG $ERROR ); use base 'Class::Base'; $VERSION = '0.01'; -$REVISION = sprintf "%d.%02d", q$Revision: 1.23 $ =~ /(\d+)\.(\d+)/; +$REVISION = sprintf "%d.%02d", q$Revision: 1.24 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; $ERROR = ""; @@ -104,7 +104,6 @@ sub init { # $self->{'debug'} = defined $config->{'debug'} ? $config->{'debug'} : $DEBUG; - $self->add_drop_table( $config->{'add_drop_table'} ); $self->custom_translate( $config->{'xlate'} ); @@ -665,35 +664,39 @@ sub load { } sub format_table_name { - my $self = shift; - my $sub = shift; - $self->{_format_table_name} = $sub if ref($sub) eq 'CODE'; - return $self->{_format_table_name}->($sub,@_) if defined($self->{_format_table_name}); - return($sub); + my $self = shift; + my $sub = shift; + $self->{'_format_table_name'} = $sub if ref $sub eq 'CODE'; + return $self->{'_format_table_name'}->( $sub, @_ ) + if defined $self->{'_format_table_name'}; + return $sub; } sub format_package_name { - my $self = shift; - my $sub = shift; - $self->{_format_package_name} = $sub if ref($sub) eq 'CODE'; - return $self->{_format_package_name}->($sub,@_) if defined($self->{_format_package_name}); - return($sub); + my $self = shift; + my $sub = shift; + $self->{'_format_package_name'} = $sub if ref $sub eq 'CODE'; + return $self->{'_format_package_name'}->( $sub, @_ ) + if defined $self->{'_format_package_name'}; + return $sub; } sub format_fk_name { - my $self = shift; - my $sub = shift; - $self->{_format_fk_name} = $sub if ref($sub) eq 'CODE'; - return $self->{_format_fk_name}->($sub,@_) if defined($self->{_format_fk_name}); - return($sub); + my $self = shift; + my $sub = shift; + $self->{'_format_fk_name'} = $sub if ref $sub eq 'CODE'; + return $self->{'_format_fk_name'}->( $sub, @_ ) + if defined $self->{'_format_fk_name'}; + return $sub; } sub format_pk_name { - my $self = shift; - my $sub = shift; - $self->{_format_pk_name} = $sub if ref($sub) eq 'CODE'; - return $self->{_format_pk_name}->($sub,@_) if defined($self->{_format_pk_name}); - return($sub); + my $self = shift; + my $sub = shift; + $self->{'_format_pk_name'} = $sub if ref $sub eq 'CODE'; + return $self->{'_format_pk_name'}->( $sub, @_ ) + if defined $self->{'_format_pk_name'}; + return $sub; } # ---------------------------------------------------------------------- @@ -730,9 +733,10 @@ SQL::Translator - convert schema from one database to another show_warnings => 0, # Print name mutations, conflicts add_drop_table => 1, # Add "drop table" statements - #make all table names CAPS in producers which support this option + # Make all table names CAPS in producers which support this option format_table_name => sub {my $tablename = shift; return uc($tablename)}, - #null-op formatting, only here for documentation's sake + + # Null-op formatting, only here for documentation's sake format_package_name => sub {return shift}, format_fk_name => sub {return shift}, format_pk_name => sub {return shift}, @@ -741,7 +745,8 @@ SQL::Translator - convert schema from one database to another my $output = $translator->translate( from => "MySQL", to => "Oracle", - filename => $file, #or an arrayref of filenames, ie [$file1,$file2,$file3] + # Or an arrayref of filenames, i.e. [ $file1, $file2, $file3 ] + filename => $file, ) or die $translator->error; print $output;