X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FSchema%2FProcedure.pm;h=8fa17429e1d0fef1fd52f12003c6a8b56c0a1c82;hb=1438295aa4383725d3edcae6c5e06a29a6dd64a7;hp=8624a5db3a938d6850b85d2a59fcb8b3ef25ccd5;hpb=45595850cc8937473606c3430c5fcbbd4b07a294;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index 8624a5d..8fa1742 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -28,18 +28,14 @@ stored procedures (and possibly other pieces of nameable SQL code?). =cut use Moo; -use SQL::Translator::Utils qw(parse_list_arg ex2err); +use SQL::Translator::Utils qw(ex2err); +use SQL::Translator::Role::ListAttr; use SQL::Translator::Types qw(schema_obj); -use List::MoreUtils qw(uniq); +use Sub::Quote qw(quote_sub); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; -our $VERSION = '1.59'; +our $VERSION = '1.61'; =head2 new @@ -63,20 +59,7 @@ Gets and set the parameters of the stored procedure. =cut -has parameters => ( - is => 'rw', - default => sub { [] }, - coerce => sub { [uniq @{parse_list_arg($_[0])}] }, -); - -around parameters => sub { - my $orig = shift; - my $self = shift; - my $fields = parse_list_arg( @_ ); - $self->$orig($fields) if @$fields; - - return wantarray ? @{ $self->$orig } : $self->$orig; -}; +with ListAttr parameters => ( uniq => 1 ); =head2 name @@ -87,7 +70,7 @@ Get or set the procedure's name. =cut -has name => ( is => 'rw', default => sub { '' } ); +has name => ( is => 'rw', default => quote_sub(q{ '' }) ); =head2 sql @@ -98,7 +81,7 @@ Get or set the procedure's SQL. =cut -has sql => ( is => 'rw', default => sub { '' } ); +has sql => ( is => 'rw', default => quote_sub(q{ '' }) ); =head2 order @@ -121,7 +104,7 @@ Get or set the owner of the procedure. =cut -has owner => ( is => 'rw', default => sub { '' } ); +has owner => ( is => 'rw', default => quote_sub(q{ '' }) ); =head2 comments @@ -135,8 +118,8 @@ Get or set the comments on a procedure. has comments => ( is => 'rw', - coerce => sub { ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }, - default => sub { [] }, + coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), + default => quote_sub(q{ [] }), ); around comments => sub {