diff options
| author | fukachan <fukachan> | 2004-05-25 03:45:20 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-05-25 03:45:20 +0000 |
| commit | f4c3fdfdd13ccd07d9d1405c1f94cb55d429d559 (patch) | |
| tree | 59a022861088c7c0f25d6a8966e3be511d843329 /fml | |
| parent | 493b14c8ed4917506d2b6a6911496fbe41176601 (diff) | |
| download | fml8-f4c3fdfdd13ccd07d9d1405c1f94cb55d429d559.tar.gz fml8-f4c3fdfdd13ccd07d9d1405c1f94cb55d429d559.tar.bz2 fml8-f4c3fdfdd13ccd07d9d1405c1f94cb55d429d559.zip | |
more strict write error tracking
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/Article/Sequence.pm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/fml/lib/FML/Article/Sequence.pm b/fml/lib/FML/Article/Sequence.pm index d698363f..f54a9585 100644 --- a/fml/lib/FML/Article/Sequence.pm +++ b/fml/lib/FML/Article/Sequence.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: Sequence.pm,v 1.11 2004/04/12 10:27:08 fukachan Exp $ +# $FML: Sequence.pm,v 1.12 2004/04/22 12:20:07 fukachan Exp $ # package FML::Article::Sequence; @@ -37,7 +37,7 @@ save it to C<$sequence_file>. # Descriptions: determine article id (sequence number) # Arguments: OBJ($self) # Side Effects: save and update the current article sequence number -# Return Value: NUM(sequence identifier) +# Return Value: NUM(sequence identifier) or 0(failed) sub increment_id { my ($self) = @_; @@ -45,6 +45,7 @@ sub increment_id my $config = $curproc->config(); my $pcb = $curproc->pcb(); my $seq_file = $config->{ article_sequence_file }; + my $error = 0; $curproc->lock($lock_channel); @@ -52,15 +53,22 @@ sub increment_id my $io = new IO::Adapter "file:$seq_file"; my $id = $io->sequence_increment(); if ($io->error()) { - $curproc->logerror( $io->error() ); + my $err = $io->error(); + $curproc->logerror( "article_id: $err" ); + $error = 1; } - # save $id in pcb (process control block) and return $id - $pcb->set('article', 'id', $id); - $curproc->unlock($lock_channel); - return $id; + unless ($error) { + # save $id in pcb (process control block) and return $id + $pcb->set('article', 'id', $id); + + return $id; + } + else { + return 0; + } } |
