'XML::Writer' => '0.500',
'Moo' => '1.000003',
'Package::Variant' => '1.001001',
+ 'Sub::Quote' => '0',
'Try::Tiny' => '0.04',
},
recommends => {
use File::Spec::Functions qw(catfile);
use File::Basename qw(dirname);
use IO::Dir;
+use Sub::Quote qw(quote_sub);
use SQL::Translator::Producer;
use SQL::Translator::Schema;
use SQL::Translator::Utils qw(throw ex2err);
has $_ => (
is => 'rw',
- default => sub { 0 },
+ default => quote_sub(q{ 0 }),
coerce => sub { $_[0] ? 1 : 0 },
) foreach qw(add_drop_table no_comments show_warnings trace validate);
# so we can allow individual producers to change the default
has quote_identifiers => (
is => 'rw',
- default => sub { '0E0' },
+ default => quote_sub(q{ '0E0' }),
coerce => sub { $_[0] || 0 },
);
has producer_type => ( is => 'rwp', init_arg => undef );
-has producer_args => ( is => 'rw', default => sub { +{} } );
+has producer_args => ( is => 'rw', default => quote_sub(q{ +{} }) );
around producer_args => sub {
my $orig = shift;
has parser_type => ( is => 'rwp', init_arg => undef );
-has parser_args => ( is => 'rw', default => sub { +{} } );
+has parser_args => ( is => 'rw', default => quote_sub(q{ +{} }) );
around parser_args => sub {
my $orig = shift;
has filters => (
is => 'rw',
- default => sub { [] },
+ default => quote_sub(q{ [] }),
coerce => sub {
my @filters;
# Set. Convert args to list of [\&code,@args]
package SQL::Translator::Role::Error;
use Moo::Role;
+use Sub::Quote qw(quote_sub);
has _ERROR => (
is => 'rw',
accessor => 'error',
init_arg => undef,
- default => sub { '' },
+ default => quote_sub(q{ '' }),
);
around error => sub {
use strictures 1;
use SQL::Translator::Utils qw(parse_list_arg ex2err);
use List::MoreUtils qw(uniq);
+use Sub::Quote qw(quote_sub);
use Package::Variant (
importing => {
has($name => (
is => 'rw',
(!$arguments{builder} ? (
- default => sub { [] },
+ default => quote_sub(q{ [] }),
) : ()),
coerce => $coerce,
%arguments,
use SQL::Translator::Schema::Table;
use SQL::Translator::Schema::Trigger;
use SQL::Translator::Schema::View;
+use Sub::Quote qw(quote_sub);
use SQL::Translator::Utils 'parse_list_arg';
use Carp;
our $VERSION = '1.59';
-has _order => (is => 'ro', default => sub { +{ map { $_ => 0 } qw/
+has _order => (is => 'ro', default => quote_sub(q{ +{ map { $_ => 0 } qw/
table
view
trigger
proc
- /} },
+ /} }),
);
# FIXME - to be removed, together with the SQL::Translator::Schema::Graph* stuff
return $g;
}
-has _tables => ( is => 'ro', init_arg => undef, default => sub { +{} } );
+has _tables => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) );
sub add_table {
return $table;
}
-has _procedures => ( is => 'ro', init_arg => undef, default => sub { +{} } );
+has _procedures => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) );
sub add_procedure {
return $proc;
}
-has _triggers => ( is => 'ro', init_arg => undef, default => sub { +{} } );
+has _triggers => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) );
sub add_trigger {
return $trigger;
}
-has _views => ( is => 'ro', init_arg => undef, default => sub { +{} } );
+has _views => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) );
sub add_view {
=cut
-has database => ( is => 'rw', default => sub { '' } );
+has database => ( is => 'rw', default => quote_sub(q{ '' }) );
sub is_valid {
=cut
-has name => ( is => 'rw', default => sub { '' } );
+has name => ( is => 'rw', default => quote_sub(q{ '' }) );
=pod
use SQL::Translator::Utils qw(ex2err throw);
use SQL::Translator::Role::ListAttr;
use SQL::Translator::Types qw(schema_obj);
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
=cut
-has deferrable => ( is => 'rw', coerce => sub { $_[0] ? 1 : 0 }, default => sub { 1 } );
+has deferrable => ( is => 'rw', coerce => sub { $_[0] ? 1 : 0 }, default => quote_sub(q{ 1 }) );
=head2 expression
=cut
-has expression => ( is => 'rw', default => sub { '' } );
+has expression => ( is => 'rw', default => quote_sub(q{ '' }) );
around expression => sub {
my ($orig, $self, $arg) = @_;
has match_type => (
is => 'rw',
- default => sub { '' },
+ default => quote_sub(q{ '' }),
coerce => sub { lc $_[0] },
isa => sub {
my $arg = $_[0];
=cut
-has name => ( is => 'rw', default => sub { '' } );
+has name => ( is => 'rw', default => quote_sub(q{ '' }) );
around name => sub {
my ($orig, $self, $arg) = @_;
=cut
-has on_delete => ( is => 'rw', default => sub { '' } );
+has on_delete => ( is => 'rw', default => quote_sub(q{ '' }) );
around on_delete => sub {
my ($orig, $self, $arg) = @_;
=cut
-has on_update => ( is => 'rw', default => sub { '' } );
+has on_update => ( is => 'rw', default => quote_sub(q{ '' }) );
around on_update => sub {
my ($orig, $self, $arg) = @_;
=cut
-has reference_table => ( is => 'rw', default => sub { '' } );
+has reference_table => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 table
has type => (
is => 'rw',
- default => sub { '' },
+ default => quote_sub(q{ '' }),
isa => sub {
throw("Invalid constraint type: $_[0]")
if $_[0] && !$VALID_CONSTRAINT_TYPE{ $_[0] };
use SQL::Translator::Schema::Constants;
use SQL::Translator::Types qw(schema_obj);
use SQL::Translator::Utils qw(parse_list_arg ex2err throw);
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
has comments => (
is => 'rw',
coerce => sub { ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] },
- default => sub { [] },
+ default => quote_sub(q{ [] }),
);
around comments => sub {
=cut
-has data_type => ( is => 'rw', default => sub { '' } );
+has data_type => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 sql_data_type
has is_nullable => (
is => 'rw',
coerce => sub { $_[0] ? 1 : 0 },
- default => sub { 1 },
+ default => quote_sub(q{ 1 }),
);
around is_nullable => sub {
=cut
-has order => ( is => 'rw', default => sub { 0 } );
+has order => ( is => 'rw', default => quote_sub(q{ 0 }) );
around order => sub {
my ( $orig, $self, $arg ) = @_;
has size => (
is => 'rw',
- default => sub { [0] },
+ default => quote_sub(q{ [0] }),
coerce => sub {
my @sizes = grep { defined && m/^\d+(?:\.\d+)?$/ } @{parse_list_arg($_[0])};
@sizes ? \@sizes : [0];
use SQL::Translator::Utils qw(ex2err throw);
use SQL::Translator::Role::ListAttr;
use SQL::Translator::Types qw(schema_obj);
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
=cut
-has name => ( is => 'rw', coerce => sub { defined $_[0] ? $_[0] : '' }, default => sub { '' } );
+has name => ( is => 'rw', coerce => sub { defined $_[0] ? $_[0] : '' }, default => quote_sub(q{ '' }) );
=head2 options
throw("Invalid index type: $type") unless $VALID_INDEX_TYPE{$type};
},
coerce => sub { uc $_[0] },
- default => sub { 'NORMAL' },
+ default => quote_sub(q{ 'NORMAL' }),
);
around type => \&ex2err;
use SQL::Translator::Utils qw(ex2err);
use SQL::Translator::Role::ListAttr;
use SQL::Translator::Types qw(schema_obj);
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
=cut
-has name => ( is => 'rw', default => sub { '' } );
+has name => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 sql
=cut
-has sql => ( is => 'rw', default => sub { '' } );
+has sql => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 order
=cut
-has owner => ( is => 'rw', default => sub { '' } );
+has owner => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 comments
has comments => (
is => 'rw',
coerce => sub { ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] },
- default => sub { [] },
+ default => quote_sub(q{ [] }),
);
around comments => sub {
package SQL::Translator::Schema::Role::Extra;
use Moo::Role;
+use Sub::Quote qw(quote_sub);
=head1 Methods
=cut
-has extra => ( is => 'rwp', default => sub { +{} } );
+has extra => ( is => 'rwp', default => quote_sub(q{ +{} }) );
around extra => sub {
my ($orig, $self) = (shift, shift);
use Carp::Clan '^SQL::Translator';
use List::Util 'max';
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
has _constraints => (
is => 'ro',
init_arg => undef,
- default => sub { +[] },
+ default => quote_sub(q{ +[] }),
predicate => 1,
lazy => 1,
);
has _indices => (
is => 'ro',
init_arg => undef,
- default => sub { [] },
+ default => quote_sub(q{ [] }),
predicate => 1,
lazy => 1,
);
has _fields => (
is => 'ro',
init_arg => undef,
- default => sub { +{} },
+ default => quote_sub(q{ +{} }),
predicate => 1,
lazy => 1
);
has comments => (
is => 'rw',
coerce => sub { ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] },
- default => sub { [] },
+ default => quote_sub(q{ [] }),
);
around comments => sub {
=cut
-has _can_link => ( is => 'ro', init_arg => undef, default => sub { +{} } );
+has _can_link => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) );
sub can_link {
my ( $self, $table1, $table2 ) = @_;
=cut
-has order => ( is => 'rw', default => sub { 0 } );
+has order => ( is => 'rw', default => quote_sub(q{ 0 }) );
around order => sub {
my ( $orig, $self, $arg ) = @_;
use SQL::Translator::Utils qw(parse_list_arg ex2err throw);
use SQL::Translator::Types qw(schema_obj);
use List::MoreUtils qw(uniq);
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
=cut
-has action => ( is => 'rw', default => sub { '' } );
+has action => ( is => 'rw', default => quote_sub(q{ '' }) );
sub is_valid {
=cut
-has name => ( is => 'rw', default => sub { '' } );
+has name => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 order
=cut
-has order => ( is => 'rw', default => sub { 0 } );
+has order => ( is => 'rw', default => quote_sub(q{ 0 }) );
around order => sub {
my ( $orig, $self, $arg ) = @_;
use SQL::Translator::Utils qw(ex2err);
use SQL::Translator::Types qw(schema_obj);
use SQL::Translator::Role::ListAttr;
+use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
=cut
-has name => ( is => 'rw', default => sub { '' } );
+has name => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 order
=cut
-has order => ( is => 'rw', default => sub { 0 } );
+has order => ( is => 'rw', default => quote_sub(q{ 0 }) );
around order => sub {
my ( $orig, $self, $arg ) = @_;
=cut
-has sql => ( is => 'rw', default => sub { '' } );
+has sql => ( is => 'rw', default => quote_sub(q{ '' }) );
=head2 schema