Due to how Context::Preserve operates the following would result in a
non-sensical error:
perl -MDBIx::Class::Schema -e '
DBIx::Class::Schema->connect("dbi:SQLite::memory:")->deployment_statements;
1
'
use base qw/DBIx::Class::Componentised DBIx::Class::AccessorGroup/;
use DBIx::Class::Exception;
-__PACKAGE__->mk_classaccessor( _skip_namespace_frames =>
- '^DBIx::Class|^SQL::Abstract|^Try::Tiny|^Class::Accessor::Grouped|^Context::Preserve|^Moose::Meta::'
+__PACKAGE__->mk_classaccessor(
+ _skip_namespace_frames => join( '|', map { '^' . $_ } qw(
+ DBIx::Class
+ SQL::Abstract
+ SQL::Translator
+ Try::Tiny
+ Class::Accessor::Grouped
+ Context::Preserve
+ Moose::Meta::
+ )),
);
sub component_base_class { 'DBIx::Class' }
sub deployment_statements {
my ($self, $schema, $type, $version, $dir, $sqltargs) = @_;
+
+ $self->throw_exception(
+ 'Calling deployment_statements() in void context makes no sense'
+ ) unless defined wantarray;
+
$type ||= $self->sqlt_type;
$version ||= $schema->schema_version || '1.x';
$dir ||= './';