-
-
21 Feb 2021 03:02:19 UTC
- Distribution: CPAN-02Packages-Search
- Module version: 0.001
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (105 / 0 / 0)
- Kwalitee
Bus factor: 1- 24.69% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (9.77KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
CPAN::02Packages::Search - Search packages in 02packages.details.txt
SYNOPSIS
use CPAN::02Packages::Search; my $index = CPAN::02Packages::Search->new(file => '/path/to/02packages.details.txt'); my $result1 = $index->search('Plack'); # { version => "1.0048", path => "M/MI/MIYAGAWA/Plack-1.0048.tar.gz" } my $result2 = $index->search('Does_Not_Exist'); # undef
DESCRIPTION
CPAN::02Packages::Search allows you to search packages in the de facto standard CPAN index file
02packages.details.txt
.MOTIVATION
We can already search packages in
02packages.details.txt
by the excellent module CPAN::Common::Index::Mirror. Its functionality is not only searching packages, but also searching authors and even fetching/caching index files.As an author of CPAN clients, I just want to search packages in
02packages.details.txt
. So I ended up extracting functionality of searching packages from CPAN::Common::Index::Mirror as CPAN::02Packages::Search.PERFORMANCE
CPAN::Common::Index::Mirror and CPAN::02Packages::Search use Search::Dict, which implements binary search. A simple benchmark shows that CPAN::02Packages::Search is 422 times faster than naive search.
❯ perl bench/bench.pl Rate naive_search our_search naive_search 4.13/s -- -100% our_search 1752/s 42291% --
See bench/bench.pl for details.
SEE ALSO
https://www.cpan.org/modules/04pause.html
AUTHOR
Shoichi Kaji <skaji@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2021 Shoichi Kaji <skaji@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install CPAN::02Packages::Search, copy and paste the appropriate command in to your terminal.
cpanm CPAN::02Packages::Search
perl -MCPAN -e shell install CPAN::02Packages::Search
For more information on module installation, please visit the detailed CPAN module installation guide.