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/
$DBI::connect_via = 'connect';
}
- try {
+ # FIXME - this should have been Try::Tiny, but triggers a leak-bug in perl(!)
+ # related to coderef refcounting. A failing test has been submitted to T::T
+ my $connect_ok = eval {
if(ref $info[0] eq 'CODE') {
$dbh = $info[0]->();
}
$dbh->{RaiseError} = 1;
$dbh->{PrintError} = 0;
}
- }
- catch {
- $self->throw_exception("DBI Connection failed: $_")
- }
- finally {
- $DBI::connect_via = $old_connect_via if $old_connect_via;
+
+ 1;
};
+ my $possible_err = $@;
+ $DBI::connect_via = $old_connect_via if $old_connect_via;
+
+ unless ($connect_ok) {
+ $self->throw_exception("DBI Connection failed: $possible_err")
+ }
+
$self->_dbh_autocommit($dbh->{AutoCommit});
$dbh;
}
}
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);