X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FSchema%2FObject.pm;h=c2aa3332106504704995bdd66e4019a1a785906e;hb=1ced2a25380c28174c07743b19820ec6d1d4f74f;hp=820236cdbdb83ca3c40d8ace06d3991a054a685a;hpb=57059659167a766beeb9d5c4fd5fd29c8eebc3b7;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Schema/Object.pm b/lib/SQL/Translator/Schema/Object.pm index 820236c..c2aa333 100644 --- a/lib/SQL/Translator/Schema/Object.pm +++ b/lib/SQL/Translator/Schema/Object.pm @@ -1,9 +1,7 @@ package SQL::Translator::Schema::Object; # ---------------------------------------------------------------------- -# $Id: Object.pm,v 1.7 2005-08-10 16:34:47 duality72 Exp $ -# ---------------------------------------------------------------------- -# Copyright (C) 2002-4 SQLFairy Authors +# 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 @@ -43,12 +41,12 @@ use Class::MakeMethods::Utility::Ref qw( ref_compare ); use vars qw[ $VERSION ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; +$VERSION = '1.59'; =head1 Construction -Derived classes should decalare their attributes using the C<_attributes> +Derived classes should declare their attributes using the C<_attributes> method. They can then inherit the C method from here which will call accessors of the same name for any values given in the hash passed to C. Note that you will have to impliment the accessors your self and we expect perl @@ -153,6 +151,32 @@ Returns a hash or a hashref. return wantarray ? %$extra : $extra; } +# ---------------------------------------------------------------------- +sub remove_extra { + +=head2 remove_extra + +L 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 { @@ -207,6 +231,7 @@ sub _compare_objects { =head1 AUTHOR -Ken Y. Clark Ekclark@cpan.orgE, Mark Addison Emark.addison@itn.co.ukE +Ken Youens-Clark Ekclark@cpan.orgE, +Mark Addison Emark.addison@itn.co.ukE. =cut