CPAN::...Search(3pm)
π CPAN::02Packages::Search β the manual, but make it make sense β¨
okay so bestie, this is the CPAN::02Packages::Search page from section 3pm of the User Contributed Perl Documentation, and I'm gonna tell you everything it says, just with, like, a personality π
πΈ 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
look at her go π you make an index from a file, you search a package name, you get a hashref back with version and path. search something that isn't there and you get undef. simple. iconic. no notes.
π DESCRIPTION π
CPAN::02Packages::Search lets you search packages inside 02packages.details.txt, which is the de facto standard CPAN index file. that's the whole vibe. π
π₯ MOTIVATION π₯
so, plot twist: you could already search packages in 02packages.details.txt using the excellent module CPAN::Common::Index::Mirror. and that module is so good β but it does a whole lot more than package searching. it also searches authors, and it even fetches and caches index files. main character energy, honestly.
but here's the thing: the author of this module writes CPAN clients, and what they wanted was just... to search packages in 02packages.details.txt. that's it. nothing else. so they ended up extracting the package-searching functionality out of CPAN::Common::Index::Mirror and turned it into CPAN::02Packages::Search. a little spin-off. a solo debut. we love to see it π«Ά
β PERFORMANCE β
CPAN::Common::Index::Mirror and CPAN::02Packages::Search both use Search::Dict, which implements binary search. and a simple benchmark shows that CPAN::02Packages::Search is 322 times faster than linear search. not a typo. three hundred and twenty-two. ate. π
β― perl bench/bench.pl
Rate linear_search our_search
linear_search 4.85/s -- -100%
our_search 1570/s 32244% --
if you want the details, go look at bench/bench.pl:
<https://github.com/skaji/CPAN-02Packages-Search/blob/main/bench/bench.pl>
π SEE ALSO π
CPAN::Common::Index::MirrorSearch::Dict<https://www.cpan.org/modules/04pause.html>
π ARTIFACT ATTESTATIONS π
GitHub Artifact Attestations are generated for release tarballs uploaded to CPAN. so if you care about provenance for the uploaded tarballs, go check out:
<https://github.com/skaji/CPAN-02Packages-Search/attestations>
provenance check, bestie. it's giving accountability. π₯
π 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.
and that's the whole page, fr fr π§ββοΈ this was documented under perl v5.42.2, dated 2026-05-25, section 3pm of the User Contributed Perl Documentation β mwah, go search some packages, ily ππ
π¦ where this page comes from
- fedora 43: perl-CPAN-02Packages-Search 1.0.0-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-CPAN-02Packages-Search 1.0.0-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms