use Data::Dumper::Concise 'Dumper';
use Sub::Name 'subname';
use Try::Tiny;
-use File::Path 'mkpath';
+use File::Path 'make_path';
use namespace::clean;
__PACKAGE__->mk_group_accessors('simple' => qw/
local $self->{_in_dbh_do} = 1;
- my @args = @_;
+ # take a ref instead of a copy, to preserve coderef @_ aliasing semantics
+ my $args = \@_;
return try {
- $self->$code ($dbh, @args);
+ $self->$code ($dbh, @$args);
} catch {
$self->throw_exception($_) if $self->connected;
if $ENV{DBIC_DBIRETRY_DEBUG};
$self->_populate_dbh;
- $self->$code($self->_dbh, @args);
+ $self->$code($self->_dbh, @$args);
};
}
my $tried = 0;
while(1) {
my $exception;
- my @args = @_;
+
+ # take a ref instead of a copy, to preserve coderef @_ aliasing semantics
+ my $args = \@_;
+
try {
$self->_get_dbh;
$self->txn_begin;
if($want_array) {
- @result = $coderef->(@args);
+ @result = $coderef->(@$args);
}
elsif(defined $want_array) {
- $result[0] = $coderef->(@args);
+ $result[0] = $coderef->(@$args);
}
else {
- $coderef->(@args);
+ $coderef->(@$args);
}
$self->txn_commit;
} catch {
}
elsif (defined $attrs->{offset}) {
# MySQL actually recommends this approach. I cringe.
- $attrs->{rows} = 2**32;
+ $attrs->{rows} = $sql_maker->__max_int;
}
my @limit;
carp "No directory given, using ./\n";
$dir = './';
} else {
- -d $dir or mkpath $dir
- or $self->throw_exception("create_ddl_dir: $! creating dir '$dir'");
+ -d $dir
+ or
+ make_path ("$dir") # make_path does not like objects (i.e. Path::Class::Dir)
+ or
+ $self->throw_exception(
+ "Failed to create '$dir': " . ($! || $@ || 'error unknow')
+ );
}
$self->throw_exception ("Directory '$dir' does not exist\n") unless(-d $dir);