Upped version numbers, cleaned up code, fixed my name.
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Object.pm
index 98fe0a7..41ce4a7 100644 (file)
@@ -41,8 +41,7 @@ use Class::MakeMethods::Utility::Ref qw( ref_compare );
 
 use vars qw[ $VERSION ];
 
-$VERSION = '1.99';
-
+$VERSION = '1.60';
 
 =head1 Construction
 
@@ -151,6 +150,32 @@ Returns a hash or a hashref.
     return wantarray ? %$extra : $extra;
 }
 
+# ----------------------------------------------------------------------
+sub remove_extra {
+
+=head2 remove_extra
+
+L</extra> can only be used to get or set "extra" attributes but not to
+remove some. Call with no args to remove all extra attributes that
+have been set before. Call with a list of key names to remove
+certain extra attributes only.
+
+  # remove all extra attributes
+  $field->remove_extra(); 
+  
+  # remove timezone and locale attributes only
+  $field->remove_extra(qw/timezone locale/);
+
+=cut
+
+    my ( $self, @keys ) = @_;
+    unless (@keys) {
+        $self->{'extra'} = {};
+    }
+    else {
+        delete $self->{'extra'}{$_} for @keys;
+    }
+}
 
 # ----------------------------------------------------------------------
 sub equals {
@@ -176,18 +201,11 @@ Determines if this object is the same as another.
 
 # ----------------------------------------------------------------------
 sub _compare_objects {
-       my $self = shift;
-       my $obj1 = shift;
-       my $obj2 = shift;
+       my $self   = shift;
+       my $obj1   = shift;
+       my $obj2   = shift;
        my $result = (ref_compare($obj1, $obj2) == 0);
-#      if ( !$result ) {
-#              use Carp qw(cluck);
-#              cluck("How did I get here?");
-#              use Data::Dumper;
-#              $Data::Dumper::Maxdepth = 1;
-#              print "obj1: ", Dumper($obj1), "\n";
-#              print "obj2: ", Dumper($obj2), "\n";
-#      }
+
        return $result;
 }
 
@@ -197,14 +215,9 @@ sub _compare_objects {
 
 =pod
 
-=head1 SEE ALSO
-
-=head1 TODO
-
-=head1 BUGS
-
 =head1 AUTHOR
 
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>, Mark Addison E<lt>mark.addison@itn.co.ukE<gt> 
+Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>, 
+Mark Addison E<lt>mark.addison@itn.co.ukE<gt>.
 
 =cut