Skip to content

Commit

Permalink
make DBI completely optional
Browse files Browse the repository at this point in the history
Previously, the 00_compile test would fail if DBI was missing. Now, it's
checked for at runtime, not compile time.

Fixes #77
  • Loading branch information
preaction committed Jan 10, 2015
1 parent aff2829 commit cb42b49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions lib/ETL/Yertl/Command/ysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ use Getopt::Long qw( GetOptionsFromArray );
use ETL::Yertl::Format::yaml;
use File::HomeDir;

BEGIN {
eval { use DBI; };
sub main {
my $class = shift;

eval { require DBI; };
if ( $@ ) {
die "Can't load ysql: Can't load DBI. Make sure the DBI module is installed.\n";
}
}

sub main {
my $class = shift;

my %opt;
if ( ref $_[-1] eq 'HASH' ) {
Expand Down
2 changes: 1 addition & 1 deletion t/bin/ysql.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ETL::Yertl::Format::yaml;
my $SHARE_DIR = path( __DIR__, '..', 'share' );

BEGIN {
eval { use DBI; use DBD::SQLite; };
eval { require DBI; require DBD::SQLite; };
if ( $@ ) {
plan skip_all => 'missing DBI and/or DBD::SQLite';
}
Expand Down

0 comments on commit cb42b49

Please sign in to comment.