From: Justin Hunter Date: Tue, 21 Jun 2011 18:30:02 +0000 (-0700) Subject: use Tie::IxHash methods and accessors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3ec58294bcff4d9059411fae7c8c9769b4cd6dc;p=dbsrgits%2FSQL-Translator-2.0-ish.git use Tie::IxHash methods and accessors --- diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 0ee4121..0ce2861 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -152,10 +152,11 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object is dirty { multi method primary_key { my $constraints = $self->constraints; - for my $key (keys %$constraints) { - return $constraints->{$key} if $constraints->{$key}{type} eq 'PRIMARY KEY'; + for my $key ($constraints->Keys) { + my $val = $constraints->FETCH($key); + return $val if $val->type eq 'PRIMARY KEY'; } - return undef; + return; } multi method primary_key(Str $column) {