missed some quotes and added tests to avoid that
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Object.pm
index 1f04b58..c2aa333 100644 (file)
@@ -1,8 +1,6 @@
 package SQL::Translator::Schema::Object;
 
 # ----------------------------------------------------------------------
-# $Id: Object.pm 1440 2009-01-17 16:31:57Z jawnsy $
-# ----------------------------------------------------------------------
 # Copyright (C) 2002-2009 SQLFairy Authors
 #
 # This program is free software; you can redistribute it and/or
@@ -41,6 +39,11 @@ use base 'Class::Data::Inheritable';
 use base 'Class::Base';
 use Class::MakeMethods::Utility::Ref qw( ref_compare );
 
+use vars qw[ $VERSION ];
+
+$VERSION = '1.59';
+
+
 =head1 Construction
 
 Derived classes should declare their attributes using the C<_attributes>
@@ -148,6 +151,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 {
@@ -202,6 +231,7 @@ sub _compare_objects {
 
 =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