use Moose;
no warnings 'uninitialized';
-our $VERSION = '0.24';
+our $VERSION = '0.28';
+$VERSION = eval $VERSION;
use Carp;
use Tie::IxHash ();
use List::Util 'first';
use MooseX::Types::Moose qw/Str HashRef Bool ArrayRef/;
use Catalyst::Model::DBIC::Schema::Types 'CreateOption';
-use Moose::Autobox;
use List::MoreUtils 'firstidx';
use Scalar::Util 'looks_like_number';
sub BUILD {
my $self = shift;
my $helper = $self->helper;
- my @args = $self->args->flatten if $self->args;
+ my @args = @{ $self->args || [] };
$helper->{schema_class} = $self->schema_class;
$self->traits(\@traits);
$helper->{traits} = '['
- .(join ',' => map { qq{'$_'} } ($self->traits->flatten))
+ .(join ',' => map { qq{'$_'} } @traits)
.']';
splice @args, $traits_idx, 1, ();
$helper->{loader_args} = $self->_build_helper_loader_args;
- if (first { /^dbi:/i } @args) {
+ my $dbi_dsn_part;
+ if (first { ($dbi_dsn_part) = /^(dbi):/i } @args) {
+ die
+qq{DSN must start with 'dbi:' not '$dbi_dsn_part' (case matters!)}
+ if $dbi_dsn_part ne 'dbi';
+
$helper->{setup_connect_info} = 1;
$helper->{connect_info} =
my %loader_args;
- while (@$args && $args->[0] !~ /^dbi:/) {
+ while (@$args && $args->[0] !~ /^dbi:/i) {
my ($key, $val) = split /=/, shift(@$args), 2;
if ($self->_is_struct($val)) {