diff options
| author | fukachan <fukachan> | 2001-01-24 06:11:31 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-24 06:11:31 +0000 |
| commit | e6a9111ca4122b24ebbc7d33bc2fcf607155a9db (patch) | |
| tree | df2a4e618111f9aa39c78e644c414836bb4eceb4 /fml/lib/FML | |
| parent | c3c2868fe6a61ee3a5c7f3a6465b5ad1259869ea (diff) | |
| download | fml8-e6a9111ca4122b24ebbc7d33bc2fcf607155a9db.tar.gz fml8-e6a9111ca4122b24ebbc7d33bc2fcf607155a9db.tar.bz2 fml8-e6a9111ca4122b24ebbc7d33bc2fcf607155a9db.zip | |
canonicalize error handlings to error() error_reason() pair
Diffstat (limited to 'fml/lib/FML')
| -rw-r--r-- | fml/lib/FML/Lock.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/SequenceFile.pm | 19 |
2 files changed, 8 insertions, 21 deletions
diff --git a/fml/lib/FML/Lock.pm b/fml/lib/FML/Lock.pm index f627c4c4..221c69b4 100644 --- a/fml/lib/FML/Lock.pm +++ b/fml/lib/FML/Lock.pm @@ -13,7 +13,7 @@ use strict; use Carp; require Exporter; -@ISA = qw(Exporter); +@ISA = qw(Exporter); # constants @@ -33,7 +33,7 @@ sub new } -sub _error_why +sub _error_reason { my $msg = @_; $Error = $msg; @@ -80,7 +80,7 @@ sub _simple_flock eval q{ $r = flock($fh, &LOCK_EX); }; - _error_why($@) if $@; + _error_reason($@) if $@; if ($r) { $FileIsLocked{ $file } = 1; @@ -88,7 +88,7 @@ sub _simple_flock } } else { - _error_why("cannot open $file"); + _error_reason("cannot open $file"); } return 0; @@ -108,7 +108,7 @@ sub _simple_funlock eval q{ $r = flock($fh, &LOCK_UN); }; - _error_why($@) if $@; + _error_reason($@) if $@; if ($r) { delete $FileIsLocked{ $file }; diff --git a/fml/lib/FML/SequenceFile.pm b/fml/lib/FML/SequenceFile.pm index dc90a48f..72329f7c 100644 --- a/fml/lib/FML/SequenceFile.pm +++ b/fml/lib/FML/SequenceFile.pm @@ -12,6 +12,7 @@ package FML::SequenceFile; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK); use Carp; +use Base::Errors qw(error_reason error error_reset); require Exporter; @ISA = qw(Exporter); @@ -34,7 +35,7 @@ sub increment_id my $seq_file = $file || $self->{ _sequence_file }; unless ($seq_file) { - $self->error_is_why("the sequence file is not specified"); + $self->error_reason("the sequence file is not specified"); return 0; }; @@ -55,7 +56,7 @@ sub increment_id $rh->close; } else { - $self->error_is_why("cannot open the sequence file"); + $self->error_reason("cannot open the sequence file"); return 0; } @@ -70,20 +71,6 @@ sub increment_id } -sub error -{ - my ($self) = @_; - return $self->{ _error }; -} - - -sub error_is_why -{ - my ($self, $msg) = @_; - $self->{ _error } = $msg; -} - - =head1 NAME FML::SequenceFile.pm - what is this |
