summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fml/lib/FML/Process/ThreadTrack.pm4
-rw-r--r--fml/lib/File/Sequence.pm15
2 files changed, 12 insertions, 7 deletions
diff --git a/fml/lib/FML/Process/ThreadTrack.pm b/fml/lib/FML/Process/ThreadTrack.pm
index 1f1107d2..13df4919 100644
--- a/fml/lib/FML/Process/ThreadTrack.pm
+++ b/fml/lib/FML/Process/ThreadTrack.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2001,2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: ThreadTrack.pm,v 1.22 2002/02/17 03:07:56 fukachan Exp $
+# $FML: ThreadTrack.pm,v 1.23 2002/02/17 13:45:10 fukachan Exp $
#
package FML::Process::ThreadTrack;
@@ -242,7 +242,7 @@ sub _speculate_last_id
if (defined $rh) {
eval q{
use File::Sequence;
- my $obj = new File::Sequence;
+ my $obj = new File::Sequence { sequence_file => $seq_file };
$last_id = $obj->search_max_id( { hash => $rh } );
};
warn($@) if $@;
diff --git a/fml/lib/File/Sequence.pm b/fml/lib/File/Sequence.pm
index e9f582af..2ee89b1a 100644
--- a/fml/lib/File/Sequence.pm
+++ b/fml/lib/File/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.19 2002/02/17 03:13:49 fukachan Exp $
+# $FML: Sequence.pm,v 1.20 2002/02/20 11:53:22 tmu Exp $
#
package File::Sequence;
@@ -226,9 +226,13 @@ sub search_max_id
return $max;
}
- # old style, search max from bottom (e.g. 0 or 1)
+ # old style, search max from bottom or top (e.g. 0 or 1)
elsif (defined $args->{ hash }) {
- $self->_search_max_id_from_bottom($args);
+ if($self->get_id() > 0) {
+ $self->_search_max_id_from_top($args);
+ } else {
+ $self->_search_max_id_from_bottom($args);
+ }
}
else {
warn("no argument");
@@ -294,16 +298,17 @@ sub _search_max_id_from_top
PEBOT_SEARCH:
while ($pebot > 0) {
last PEBOT_SEARCH if defined $hash->{ $pebot - $unit };
+ last PEBOT_SEARCH if(($pebot - $unit) <= 0);
$pebot -= $unit;
print STDERR "1. ", $pebot, "\n" if defined $ENV{'debug'};
}
# decrement by 1.
- do {
+ while(! defined $hash->{ $pebot - 1 }) {
$pebot--;
return 0 if($pebot <= 0);
print STDERR "2. ", $pebot, "\n" if defined $ENV{'debug'};
- } unless (defined $hash->{ $pebot - 1 });
+ }
return $pebot;