Mooify SQLT::Schema::Index
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Constraint.pm
index 555a95b..8f09736 100644 (file)
@@ -1,23 +1,5 @@
 package SQL::Translator::Schema::Constraint;
 
-# ----------------------------------------------------------------------
-# 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
@@ -42,14 +24,15 @@ C<SQL::Translator::Schema::Constraint> is the constraint object.
 =cut
 
 use strict;
+use warnings;
 use SQL::Translator::Schema::Constants;
 use SQL::Translator::Utils 'parse_list_arg';
 
 use base 'SQL::Translator::Schema::Object';
 
-use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT);
+ our ( $TABLE_COUNT, $VIEW_COUNT );
 
-$VERSION = '1.59';
+our $VERSION = '1.59';
 
 my %VALID_CONSTRAINT_TYPE = (
     PRIMARY_KEY, 1,
@@ -59,8 +42,6 @@ my %VALID_CONSTRAINT_TYPE = (
     NOT_NULL,    1,
 );
 
-# ----------------------------------------------------------------------
-
 __PACKAGE__->_attributes( qw/
     table name type fields reference_fields reference_table
     match_type on_delete on_update expression deferrable
@@ -95,7 +76,6 @@ Object constructor.
     $self->SUPER::init(@_);
 }
 
-# ----------------------------------------------------------------------
 sub deferrable {
 
 =pod
@@ -121,7 +101,6 @@ False, so the following are eqivalent:
     return defined $self->{'deferrable'} ? $self->{'deferrable'} : 1;
 }
 
-# ----------------------------------------------------------------------
 sub expression {
 
 =pod
@@ -144,7 +123,6 @@ Gets and set the expression used in a CHECK constraint.
     return $self->{'expression'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub is_valid {
 
 =pod
@@ -207,7 +185,6 @@ Determine whether the constraint is valid or not.
     return 1;
 }
 
-# ----------------------------------------------------------------------
 sub fields {
 
 =pod
@@ -260,7 +237,6 @@ Returns undef or an empty list if the constraint has no fields set.
     }
 }
 
-# ----------------------------------------------------------------------
 sub field_names {
 
 =head2 field_names
@@ -277,7 +253,6 @@ avoid the overload magic of the Field objects returned by the fields method.
     return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || '');
 }
 
-# ----------------------------------------------------------------------
 sub match_type {
 
 =pod
@@ -303,7 +278,6 @@ Get or set the constraint's match_type.  Only valid values are "full"
     return $self->{'match_type'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub name {
 
 =pod
@@ -322,7 +296,6 @@ Get or set the constraint's name.
     return $self->{'name'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub options {
 
 =pod
@@ -350,8 +323,6 @@ Returns an array or array reference.
     }
 }
 
-
-# ----------------------------------------------------------------------
 sub on_delete {
 
 =pod
@@ -374,7 +345,6 @@ Get or set the constraint's "on delete" action.
     return $self->{'on_delete'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub on_update {
 
 =pod
@@ -397,7 +367,6 @@ Get or set the constraint's "on update" action.
     return $self->{'on_update'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub reference_fields {
 
 =pod
@@ -456,7 +425,6 @@ arrayref; returns an array or array reference.
     }
 }
 
-# ----------------------------------------------------------------------
 sub reference_table {
 
 =pod
@@ -474,7 +442,6 @@ Get or set the table referred to by the constraint.
     return $self->{'reference_table'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub table {
 
 =pod
@@ -497,7 +464,6 @@ Get or set the constraint's table object.
     return $self->{'table'};
 }
 
-# ----------------------------------------------------------------------
 sub type {
 
 =pod
@@ -523,7 +489,6 @@ Get or set the constraint's type.
     return $self->{'type'} || '';
 }
 
-# ----------------------------------------------------------------------
 sub equals {
 
 =pod
@@ -589,7 +554,6 @@ Determines if this constraint is the same as another
     return 1;
 }
 
-# ----------------------------------------------------------------------
 sub DESTROY {
     my $self = shift;
     undef $self->{'table'}; # destroy cyclical reference
@@ -597,8 +561,6 @@ sub DESTROY {
 
 1;
 
-# ----------------------------------------------------------------------
-
 =pod
 
 =head1 AUTHOR