1 warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
3 ;# Usage: &look(*FILEHANDLE,$key,$dict,$fold)
5 # This library is no longer being maintained, and is included for backward
6 # compatibility with Perl 4 programs which may require it.
7 # This legacy library is deprecated and will be removed in a future
10 # In particular, this should not be used as an example of modern Perl
11 # programming techniques.
13 ;# Sets file position in FILEHANDLE to be first line greater than or equal
14 ;# (stringwise) to $key. Pass flags for dictionary order and case folding.
17 local(*FH,$key,$dict,$fold) = @_;
18 local($max,$min,$mid,$_);
19 local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
20 $blksize,$blocks) = stat(FH);
21 $blksize = 8192 unless $blksize;
22 $key =~ s/[^\w\s]//g if $dict;
23 $key = lc $key if $fold;
24 $max = int($size / $blksize);
25 while ($max - $min > 1) {
26 $mid = int(($max + $min) / 2);
27 seek(FH,$mid * $blksize,0);
28 $_ = <FH> if $mid; # probably a partial line
31 s/[^\w\s]//g if $dict;
45 s/[^\w\s]//g if $dict;