catch up Object::Simple upda...
|
1 |
use Test::More; |
2 |
use strict; |
|
3 |
use warnings; |
|
4 |
|
|
5 |
# user password database |
|
cleanup
|
6 |
our ($USER, $PASSWORD, $DATABASE) = connect_info(); |
catch up Object::Simple upda...
|
7 |
|
cleanup
|
8 |
plan skip_all => 'private MySQL test' unless $USER; |
catch up Object::Simple upda...
|
9 |
|
10 |
plan 'no_plan'; |
|
11 |
|
|
12 |
use DBI::Custom; |
|
13 |
use Scalar::Util 'blessed'; |
|
14 |
{ |
|
15 |
my $dbi = DBI::Custom->new( |
|
cleanup
|
16 |
user => $USER, |
17 |
password => $PASSWORD, |
|
18 |
data_source => "dbi:mysql:dbname=$DATABASE" |
|
catch up Object::Simple upda...
|
19 |
); |
20 |
$dbi->connect; |
|
21 |
|
|
22 |
ok(blessed $dbi->dbh); |
|
23 |
can_ok($dbi->dbh, qw/prepare/); |
|
24 |
} |
|
25 |
|
|
26 |
sub connect_info { |
|
27 |
my $file = 'password.tmp'; |
|
28 |
open my $fh, '<', $file |
|
29 |
or return; |
|
30 |
|
|
31 |
my ($user, $password, $database) = split(/\s/, (<$fh>)[0]); |
|
32 |
|
|
33 |
close $fh; |
|
34 |
|
|
35 |
return ($user, $password, $database); |
|
36 |
} |