diff options
| author | fukachan <fukachan> | 2003-11-29 10:50:43 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-11-29 10:50:43 +0000 |
| commit | 6d669e3531dc6d543d743718ff43bd21fd50a9ee (patch) | |
| tree | ea7d2e58ba430be6f645e029b7c726dd136858e5 | |
| parent | 1999d43aed3c53f74216f85e84d7a3929cb45521 (diff) | |
| download | fml8-6d669e3531dc6d543d743718ff43bd21fd50a9ee.tar.gz fml8-6d669e3531dc6d543d743718ff43bd21fd50a9ee.tar.bz2 fml8-6d669e3531dc6d543d743718ff43bd21fd50a9ee.zip | |
FNF: defined() check
| -rw-r--r-- | fml/lib/FML/Confirm.pm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/fml/lib/FML/Confirm.pm b/fml/lib/FML/Confirm.pm index e7c02702..05dbd009 100644 --- a/fml/lib/FML/Confirm.pm +++ b/fml/lib/FML/Confirm.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Confirm.pm,v 1.12 2003/11/17 13:06:11 fukachan Exp $ +# $FML: Confirm.pm,v 1.13 2003/11/22 05:41:50 fukachan Exp $ # package FML::Confirm; @@ -257,13 +257,18 @@ This cache uses C<FML::Cache::Journal> based on C<Tie::JournaledDir>. sub _open_db { my ($self) = @_; - my $db = $self->{ _journal_db }; - my $dir = $self->{ _cache_dir }; - my $class = $self->{ _class }; - my $_db = $db->open($dir, $class); + my $db = $self->{ _journal_db }; - $self->{ _db } = $_db; - return $_db; + if (defined $db) { + my $dir = $self->{ _cache_dir }; + my $class = $self->{ _class }; + my $_db = $db->open($dir, $class); + $self->{ _db } = $_db; + return $_db; + } + else { + return undef; + } } @@ -275,7 +280,9 @@ sub _close_db { my ($self) = @_; my $db = $self->{ _journal_db }; - $db->close(); + if (defined $db) { + $db->close(); + } } |
