summaryrefslogtreecommitdiff
path: root/lib/Search
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2000-12-05 16:23:28 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-06 16:09:09 +0000
commitb75c8c73cd7f3c92a16e03fb046f4e2a99363bc7 (patch)
tree5fb2cf9e3d6c40bda2bc9505b5cb8026acdb24dc /lib/Search
parentd2ab394d8cfda924d5c38dd9722ad367a06ffeca (diff)
downloadperl-b75c8c73cd7f3c92a16e03fb046f4e2a99363bc7.tar.gz
$VERSION crusade, strict, tests, etc... all over lib/
Message-ID: <20001205212328.C6473@blackrider.aocn.com> Carp::Heavy parts not very applicable because of recent changes. p4raw-id: //depot/perl@8013
Diffstat (limited to 'lib/Search')
-rw-r--r--lib/Search/Dict.pm27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/Search/Dict.pm b/lib/Search/Dict.pm
index 9a229a7bc0..58c7543ced 100644
--- a/lib/Search/Dict.pm
+++ b/lib/Search/Dict.pm
@@ -2,8 +2,11 @@ package Search::Dict;
require 5.000;
require Exporter;
-@ISA = qw(Exporter);
-@EXPORT = qw(look);
+use strict;
+
+our $VERSION = '1.00';
+our @ISA = qw(Exporter);
+our @EXPORT = qw(look);
=head1 NAME
@@ -30,9 +33,9 @@ If I<$fold> is true, ignore case.
=cut
sub look {
- local(*FH,$key,$dict,$fold) = @_;
+ my($fh,$key,$dict,$fold) = @_;
local($_);
- my(@stat) = stat(FH)
+ my(@stat) = stat($fh)
or return -1;
my($size, $blksize) = @stat[7,11];
$blksize ||= 8192;
@@ -41,10 +44,10 @@ sub look {
my($min, $max, $mid) = (0, int($size / $blksize));
while ($max - $min > 1) {
$mid = int(($max + $min) / 2);
- seek(FH, $mid * $blksize, 0)
+ seek($fh, $mid * $blksize, 0)
or return -1;
- <FH> if $mid; # probably a partial line
- $_ = <FH>;
+ <$fh> if $mid; # probably a partial line
+ $_ = <$fh>;
chop;
s/[^\w\s]//g if $dict;
$_ = lc $_ if $fold;
@@ -56,19 +59,19 @@ sub look {
}
}
$min *= $blksize;
- seek(FH,$min,0)
+ seek($fh,$min,0)
or return -1;
- <FH> if $min;
+ <$fh> if $min;
for (;;) {
- $min = tell(FH);
- defined($_ = <FH>)
+ $min = tell($fh);
+ defined($_ = <$fh>)
or last;
chop;
s/[^\w\s]//g if $dict;
$_ = lc $_ if $fold;
last if $_ ge $key;
}
- seek(FH,$min,0);
+ seek($fh,$min,0);
$min;
}