Skip to content

Commit

Permalink
Check for definedness of $self->brain in Hailo::Storage::*
Browse files Browse the repository at this point in the history
This catches:

    $ perl -Ilib script/hailo --train /tmp/fooblaoeu
    Use of uninitialized value $db in concatenation (.) or string at lib/Hailo/Storage/SQL.pm line 52.
    Use of uninitialized value in -s at lib/Hailo/Storage/SQLite.pm line 31.
  • Loading branch information
avar committed Jan 29, 2010
1 parent 1cee908 commit 13cb906
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
0.05
- Shuffle key tokens and don't reuse them. Should make for more random
replies.
- Check for definedness of $self->brain in Hailo::Storage::*

0.04 Fri Jan 29 17:48:49 GMT 2010
- You know that bug we talked about being fixed in 0.03? It was
Expand Down
2 changes: 1 addition & 1 deletion lib/Hailo/Storage/SQL.pm
Expand Up @@ -47,7 +47,7 @@ sub _build_dbi_options {
my ($self) = @_;
my $dbd = $self->dbd;
my $dbd_options = $self->dbd_options;
my $db = $self->brain;
my $db = $self->brain // '';

my @options = (
"dbi:$dbd:dbname=$db",
Expand Down
2 changes: 1 addition & 1 deletion lib/Hailo/Storage/SQLite.pm
Expand Up @@ -28,7 +28,7 @@ after stop_training => sub {

sub _exists_db {
my ($self) = @_;
return -s $self->brain;
return defined $self->brain and -s $self->brain;
}

__PACKAGE__->meta->make_immutable;
Expand Down

0 comments on commit 13cb906

Please sign in to comment.