Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions dist/Search-Dict/lib/Search/Dict.pm
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package Search::Dict;
require 5.000;
require Exporter;
use strict;
use Exporter;

my $fc_available;
BEGIN {
$fc_available = '5.015008';
if ( $] ge $fc_available ) {
require feature;
'feature'->import('fc'); # string avoids warning on old Perls <sigh>
}
if ("$]" >= 5.015008) {
require feature;
'feature'->import('fc'); # string avoids warning on old Perls <sigh>
} else {
# ($) prototype, not (_), for perl 5.8 compatibility, just in case
*fc = sub ($) { lc $_[0] };
}
}

use strict;

our $VERSION = '1.07';
our $VERSION = '1.08';
our @ISA = qw(Exporter);
our @EXPORT = qw(look);

Expand All @@ -27,7 +26,7 @@ Search::Dict - look - search for key in dictionary file
look *FILEHANDLE, $key, $dict, $fold;

use Search::Dict;
look *FILEHANDLE, $params;
look *FILEHANDLE, $key, $params;

=head1 DESCRIPTION

Expand Down Expand Up @@ -80,7 +79,7 @@ sub look {
$blksize ||= 8192;
$key =~ s/[^\w\s]//g if $dict;
if ( $fold ) {
$key = $] ge $fc_available ? fc($key) : lc($key);
$key = fc($key);
}
# find the right block
my($min, $max) = (0, int($size / $blksize));
Expand All @@ -95,7 +94,7 @@ sub look {
chomp;
s/[^\w\s]//g if $dict;
if ( $fold ) {
$_ = $] ge $fc_available ? fc($_) : lc($_);
$_ = fc($_);
}
if (defined($_) && $comp->($_, $key) < 0) {
$min = $mid;
Expand All @@ -117,7 +116,7 @@ sub look {
chomp;
s/[^\w\s]//g if $dict;
if ( $fold ) {
$_ = $] ge $fc_available ? fc($_) : lc($_);
$_ = fc($_);
}
last if $comp->($_, $key) >= 0;
}
Expand Down
6 changes: 6 additions & 0 deletions pod/perldelta.pod
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ XXX If there was something important to note about this change, include that her

=item *

L<Search::Dict> has been upgraded from version 1.07 to 1.08.

A missing parameter has been added to the sample code in the SYNOPSIS.

=item *

L<builtin> has been upgraded from version 0.017 to 0.018.

On platforms that don't support Inf/NaN values in floating-point numbers (such
Expand Down
Loading