1CPAN::02Packages::SearcUhs(e3rpmC)ontributed Perl DocumeCnPtAaNt:i:o0n2Packages::Search(3pm)
2
3
4

NAME

6       CPAN::02Packages::Search - Search packages in 02packages.details.txt
7

SYNOPSIS

9         use CPAN::02Packages::Search;
10
11         my $index = CPAN::02Packages::Search->new(file => '/path/to/02packages.details.txt');
12
13         my $result1 = $index->search('Plack'); # { version => "1.0048", path => "M/MI/MIYAGAWA/Plack-1.0048.tar.gz" }
14         my $result2 = $index->search('Does_Not_Exist'); # undef
15

DESCRIPTION

17       CPAN::02Packages::Search allows you to search packages in the de facto
18       standard CPAN index file "02packages.details.txt".
19

MOTIVATION

21       We can already search packages in "02packages.details.txt" by the
22       excellent module CPAN::Common::Index::Mirror.  Its functionality is not
23       only searching packages, but also searching authors and even
24       fetching/caching index files.
25
26       As an author of CPAN clients, I just want to search packages in
27       "02packages.details.txt".  So I ended up extracting functionality of
28       searching packages from CPAN::Common::Index::Mirror as
29       CPAN::02Packages::Search.
30

PERFORMANCE

32       CPAN::Common::Index::Mirror and CPAN::02Packages::Search use
33       Search::Dict, which implements binary search.  A simple benchmark shows
34       that CPAN::02Packages::Search is 422 times faster than naive search.
35
36         X perl bench/bench.pl
37                        Rate naive_search   our_search
38         naive_search 4.13/s           --        -100%
39         our_search   1752/s       42291%           --
40
41       See bench/bench.pl <https://github.com/skaji/CPAN-02Packages-
42       Search/blob/main/bench/bench.pl> for details.
43

SEE ALSO

45       CPAN::Common::Index::Mirror
46
47       Search::Dict
48
49       <https://www.cpan.org/modules/04pause.html>
50

AUTHOR

52       Shoichi Kaji <skaji@cpan.org>
53
55       Copyright 2021 Shoichi Kaji <skaji@cpan.org>
56
57       This library is free software; you can redistribute it and/or modify it
58       under the same terms as Perl itself.
59
60
61
62perl v5.36.0                      2022-11-03     CPAN::02Packages::Search(3pm)
Impressum