our > use vars
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Table.pm
index 70bb1d4..67fdb17 100644 (file)
@@ -1,23 +1,5 @@
 package SQL::Translator::Schema::Table;
 
-# ----------------------------------------------------------------------
-# Copyright (C) 2002-2009 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307  USA
-# -------------------------------------------------------------------
-
 =pod
 
 =head1 NAME
@@ -38,6 +20,7 @@ C<SQL::Translator::Schema::Table> is the table object.
 =cut
 
 use strict;
+use warnings;
 use SQL::Translator::Utils 'parse_list_arg';
 use SQL::Translator::Schema::Constants;
 use SQL::Translator::Schema::Constraint;
@@ -47,9 +30,7 @@ use Data::Dumper;
 
 use base 'SQL::Translator::Schema::Object';
 
-use vars qw( $VERSION );
-
-$VERSION = '1.59';
+our $VERSION = '1.59';
 
 # Stringify to our name, being careful not to pass any args through so we don't
 # accidentally set it to undef. We also have to tweak bool so the object is
@@ -60,8 +41,6 @@ use overload
     fallback => 1,
 ;
 
-# ----------------------------------------------------------------------
-
 __PACKAGE__->_attributes( qw/schema name comments options order/ );
 
 =pod
@@ -89,9 +68,6 @@ sub new {
   return $self;
 }
 
-
-
-# ----------------------------------------------------------------------
 sub add_constraint {
 
 =pod
@@ -177,7 +153,6 @@ C<SQL::Translator::Schema::Constraint> object.
     return $constraint;
 }
 
-# ----------------------------------------------------------------------
 sub drop_constraint {
 
 =pod
@@ -214,7 +189,6 @@ an index name or an C<SQL::Translator::Schema::Constraint> object.
     return $constraint;
 }
 
-# ----------------------------------------------------------------------
 sub add_index {
 
 =pod
@@ -256,7 +230,6 @@ C<SQL::Translator::Schema::Index> object.
     return $index;
 }
 
-# ----------------------------------------------------------------------
 sub drop_index {
 
 =pod
@@ -293,7 +266,6 @@ an index name of an C<SQL::Translator::Schema::Index> object.
     return $index;
 }
 
-# ----------------------------------------------------------------------
 sub add_field {
 
 =pod
@@ -347,7 +319,7 @@ existing field, you will get an error and the field will not be created.
 
     return $field;
 }
-# ----------------------------------------------------------------------
+
 sub drop_field {
 
 =pod
@@ -400,7 +372,6 @@ a field name or an C<SQL::Translator::Schema::Field> object.
     return $field;
 }
 
-# ----------------------------------------------------------------------
 sub comments {
 
 =pod
@@ -437,7 +408,6 @@ all the comments joined on newlines.
     }
 }
 
-# ----------------------------------------------------------------------
 sub get_constraints {
 
 =pod
@@ -462,7 +432,6 @@ Returns all the constraint objects as an array or array reference.
     }
 }
 
-# ----------------------------------------------------------------------
 sub get_indices {
 
 =pod
@@ -488,7 +457,6 @@ Returns all the index objects as an array or array reference.
     }
 }
 
-# ----------------------------------------------------------------------
 sub get_field {
 
 =pod
@@ -516,7 +484,6 @@ Returns a field by the name provided.
     return $self->{'fields'}{ $field_name };
 }
 
-# ----------------------------------------------------------------------
 sub get_fields {
 
 =pod
@@ -545,7 +512,6 @@ Returns all the field objects as an array or array reference.
     }
 }
 
-# ----------------------------------------------------------------------
 sub is_valid {
 
 =pod
@@ -571,7 +537,6 @@ Determine whether the view is valid or not.
     return 1;
 }
 
-# ----------------------------------------------------------------------
 sub is_trivial_link {
 
 =pod
@@ -631,7 +596,6 @@ Returns true if the table has some non-key fields.
     return $self->{'is_data'};
 }
 
-# ----------------------------------------------------------------------
 sub can_link {
 
 =pod
@@ -723,7 +687,6 @@ Determine whether the table can link two arg tables via many-to-many.
     return $self->{'can_link'}{ $table1->name }{ $table2->name };
 }
 
-# ----------------------------------------------------------------------
 sub name {
 
 =pod
@@ -756,7 +719,6 @@ that name and disallows the change if one exists (setting the error to
     return $self->{'name'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub schema {
 
 =pod
@@ -779,7 +741,6 @@ Get or set the table's schema object.
     return $self->{'schema'};
 }
 
-# ----------------------------------------------------------------------
 sub primary_key {
 
 =pod
@@ -845,7 +806,6 @@ These are eqivalent:
     return;
 }
 
-# ----------------------------------------------------------------------
 sub options {
 
 =pod
@@ -872,7 +832,6 @@ an array or array reference.
     }
 }
 
-# ----------------------------------------------------------------------
 sub order {
 
 =pod
@@ -894,7 +853,6 @@ Get or set the table's order.
     return $self->{'order'} || 0;
 }
 
-# ----------------------------------------------------------------------
 sub field_names {
 
 =head2 field_names
@@ -922,7 +880,6 @@ avoid the overload magic of the Field objects returned by the get_fields method.
     }
 }
 
-# ----------------------------------------------------------------------
 sub equals {
 
 =pod
@@ -1011,8 +968,6 @@ INDEX2:
    return 1;
 }
 
-# ----------------------------------------------------------------------
-
 =head1 LOOKUP METHODS
 
 The following are a set of shortcut methods for getting commonly used lists of
@@ -1060,7 +1015,6 @@ sub pkey_fields {
     return wantarray ? @fields : \@fields;
 }
 
-# ----------------------------------------------------------------------
 sub fkey_fields {
     my $me = shift;
     my @fields;
@@ -1068,14 +1022,12 @@ sub fkey_fields {
     return wantarray ? @fields : \@fields;
 }
 
-# ----------------------------------------------------------------------
 sub nonpkey_fields {
     my $me = shift;
     my @fields = grep { !$_->is_primary_key } $me->get_fields;
     return wantarray ? @fields : \@fields;
 }
 
-# ----------------------------------------------------------------------
 sub data_fields {
     my $me = shift;
     my @fields =
@@ -1083,7 +1035,6 @@ sub data_fields {
     return wantarray ? @fields : \@fields;
 }
 
-# ----------------------------------------------------------------------
 sub unique_fields {
     my $me = shift;
     my @fields;
@@ -1091,21 +1042,18 @@ sub unique_fields {
     return wantarray ? @fields : \@fields;
 }
 
-# ----------------------------------------------------------------------
 sub unique_constraints {
     my $me = shift;
     my @cons = grep { $_->type eq UNIQUE } $me->get_constraints;
     return wantarray ? @cons : \@cons;
 }
 
-# ----------------------------------------------------------------------
 sub fkey_constraints {
     my $me = shift;
     my @cons = grep { $_->type eq FOREIGN_KEY } $me->get_constraints;
     return wantarray ? @cons : \@cons;
 }
 
-# ----------------------------------------------------------------------
 sub DESTROY {
     my $self = shift;
     undef $self->{'schema'}; # destroy cyclical reference
@@ -1116,8 +1064,6 @@ sub DESTROY {
 
 1;
 
-# ----------------------------------------------------------------------
-
 =pod
 
 =head1 AUTHORS