CPAN::...Search(3pm)

πŸ“¦
version 1.0.0 Β· 6 versions
, in fedora 43, fedora 44

πŸ’– 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 🌈


πŸ‘‘ 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 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