use Sub::Quote qw(quote_sub);
use SQL::Translator::Producer;
use SQL::Translator::Schema;
-use SQL::Translator::Utils qw(throw ex2err);
+use SQL::Translator::Utils qw(throw ex2err carp_ro);
$DEFAULT_SUB = sub { $_[0]->schema } unless defined $DEFAULT_SUB;
has producer_type => ( is => 'rwp', init_arg => undef );
+around producer_type => carp_ro('producer_type');
+
has producer_args => ( is => 'rw', default => quote_sub(q{ +{} }) );
around producer_args => sub {
has parser_type => ( is => 'rwp', init_arg => undef );
+around parser_type => carp_ro('parser_type');
+
has parser_args => ( is => 'rw', default => quote_sub(q{ +{} }) );
around parser_args => sub {
use Moo 1.000003;
use SQL::Translator::Schema::Constants;
use SQL::Translator::Types qw(schema_obj);
-use SQL::Translator::Utils qw(parse_list_arg ex2err throw);
+use SQL::Translator::Utils qw(parse_list_arg ex2err throw carp_ro);
use Sub::Quote qw(quote_sub);
extends 'SQL::Translator::Schema::Object';
has is_unique => ( is => 'lazy', init_arg => undef );
+around is_unique => carp_ro('is_unique');
+
sub _build_is_unique {
my ( $self ) = @_;
use File::Spec;
use Scalar::Util qw(blessed);
use Try::Tiny;
+use Carp qw(carp);
our $VERSION = '1.59';
our $DEFAULT_COMMENT = '-- ';
debug normalize_name header_comment parse_list_arg truncate_id_uniquely
$DEFAULT_COMMENT parse_mysql_version parse_dbms_version
ddl_parser_instance
- throw ex2err
+ throw ex2err carp_ro
);
use constant COLLISION_TAG_LENGTH => 8;
};
}
+sub carp_ro {
+ my ($name) = @_;
+ return sub {
+ my ($orig, $self) = (shift, shift);
+ carp "'$name' is a read-only accessor" if @_;
+ return $self->$orig;
+ };
+}
+
1;
=pod
...
};
+=head2 carp_ro
+
+Takes a field name and returns a reference to a function can be used
+L<around|Moo/around> a read-only accessor to make it L<carp|Carp/carp>
+instead of die when passed an argument.
+
=head1 AUTHORS
Darren Chamberlain E<lt>darren@cpan.orgE<gt>,