From: Justin Hunter Date: Sat, 22 Aug 2009 21:25:14 +0000 (-0700) Subject: add translator object to parser X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=094c084fb3d392a959111d1cca2a8335a365a93e;p=dbsrgits%2FSQL-Translator-2.0-ish.git add translator object to parser --- diff --git a/lib/SQL/Translator/Parser.pm b/lib/SQL/Translator/Parser.pm index bce6f86..eb02146 100644 --- a/lib/SQL/Translator/Parser.pm +++ b/lib/SQL/Translator/Parser.pm @@ -1,8 +1,7 @@ use MooseX::Declare; class SQL::Translator::Parser { - use MooseX::Types::Moose qw(Str); - use SQL::Translator::Types qw(DBIHandle); - use aliased 'SQL::Translator::Object::Schema'; + use MooseX::Types::Moose qw(Maybe Str); + use SQL::Translator::Types qw(DBIHandle Translator); has 'dbh' => ( isa => DBIHandle, @@ -17,11 +16,19 @@ class SQL::Translator::Parser { ); has 'type' => ( - isa => Str, + isa => Maybe[Str], is => 'ro', predicate => 'has_type', ); + has 'translator' => ( + isa => Translator, + is => 'ro', + weak_ref => 1, + required => 1, + handles => [ qw(schema) ], + ); + method BUILD(@) { my $role = __PACKAGE__; if ($self->has_dbh) {