CPAN::...Search(3pm)
π CPAN::SQLite::Search π
okay bestie, gather round, because this is the manual page for CPAN::SQLite::Search (a 3pm page, if you're keeping track of the manual name situation) and it is literally the module that does queries on the database. That's it, that's the NAME section, we ate. π
β¨ VERSION β¨
version 0.220 β that's the vibe check result, and it passed. π
π SYNOPSIS π
here's the whole situation, verbatim, no cap:
my $max_results = 200;
my $query = CPAN::SQLite::Search->new(db_dir => $db_dir,
db_name => $db_name,
max_results => $max_results);
$query->query(mode => 'module', name => 'Net::FTP');
my $results = $query->{results};
look at her go π
π CONSTRUCTING THE QUERY π
so this module queries the database through various types of queries and hands you back the results so you can display them later. main character behavior fr fr.
the CPAN::SQLite::Search object gets created via the new method, like this:
my $query = CPAN::SQLite::Search->new(db_dir => $db_dir,
db_name => $db_name,
max_results => $max_results);
and new takes these arguments, bestie, write them down:
db_dir => $db_dirβ this is the directory where the database file lives. it's optional if you gave theCPANoption instead. lowkey flexible of her.CPAN => $CPANβ this one specifies thecpan_homedirectory of an already configured CPAN.pm, which is where the database file will be stored if you didn't givedb_dir. she's got a backup plan, iconic.max_results => $max_resultsβ the maximum value used to cap the number of results returned under a user query. if you don't specify it, a value contained withinCPAN::SQLite::Searchgets used instead. default queen π
a basic query then gets constructed like:
$query->query(mode => $mode, $type => $value);
and the results are available as:
my $results = $query->{results}
there are three basic modes, and they're all serving:
moduleβ for information on modules. modules modules modules β¨distβ for information on distributions.authorβ for information on CPAN authors or cpanids. the people!! the icons!! the legends!!
πΈ "module", "dist", and "author" modes πΈ
for a mode of module, dist, and author, there are four basic options you can use for the $type => $value situation:
query => $query_termβ this searches through module names, distribution names, or CPAN author names and ids (formodule,dist, andauthormodes respectively, bestie, keep up). the results are case insensitive, and Perl regular expressions for the$query_termare recognized. regex girlies rise up π§name => $nameβ this reports exact matches in a case sensitive manner, for the module name, distribution name, or CPAN author id, formodule,dist, andauthormodes respectively. picky! specific! we respect it.id => $idβ this looks up information on the primary key according to the mode you specified. it's more for internal use, to help speed up queries. using this "publically" is probably not a good idea, because the ids may change over the course of time. so like, don't. π
π RESULTS π
after making the query, you access the results through:
my $results = $query->{results};
okay so important: no results can mean either that no matches were found, or that an error happened while making the query β in which case a brief error message is contained in $query->{error}. two very different stories, same empty vibe. π
assuming there are results, what gets returned depends on the mode and on the type of query. peep CPAN::SQLite::Populate for a description of the fields in the various tables listed below β those fields are used as the keys of the hash references that arise. slay.
π¦ "author" mode π¦
nameoridquery β this returns theauth_id,cpanid,email, andfullnameof theauthstable. as well, an array reference$results->{dists}is returned, representing all distributions associated with thatcpanidβ each member of the array reference is a hash reference describing thedist_id,dist_name,dist_abs,dist_vers, anddist_filefields in thediststable. an additional entry,download, is supplied, which you can use as$CPAN/authors/id/$downloadto specify the url of the distribution. she comes with extras, periodt.queryquery β if this results in more than one match, an array reference is returned, each member of which is a hash reference containing theauth_id,cpanid, andfullnamefields. if there's only one result found, anamequery based on the matchedcpanidis performed. one match and she switches strategies, adaptive icon π
π«Ά "module" mode π«Ά
nameoridquery β this returns themod_id,mod_name,mod_abs,mod_vers,dist_id,dist_name,dist_file,auth_id,cpanid,fullname, andemailof theauths,mods, anddiststables. as well, the following entries may be present:downloadβ this can be used as$CPAN/authors/id/$downloadto specify the url of the distribution.
queryquery β if this results in more than one match, an array reference is returned, each member of which is a hash reference containing themod_id,mod_name,mod_abs,mod_abs,dist_vers,dist_abs,auth_id,cpanid,dist_id,dist_name, anddist_file. as well, adownloadfield which can be used as$CPAN/authors/id/$downloadto specify the url of the distribution is provided. if there's only one result found, anamequery based on the matchedmod_nameis performed. (yes,mod_absshows up twice up there β that's what the page says, and I am not editing the queen's list π)
π "dist" mode π
nameoridquery β this returns thedist_id,dist_name,dist_abs,dist_vers,dist_file,size,birth,auth_id,cpanid, andfullnameof theauths,mods, anddiststables. as well, the following entries may be present:downloadβ this can be used as$CPAN/authors/id/$downloadto specify the url of the distribution.modsβ this is an array reference containing information on the modules present. each entry is a hash reference containing themod_id,mod_name,mod_abs, andmod_versfields for the module.
queryquery β if this results in more than one match, an array reference is returned, each member of which is a hash reference containing thedist_id,dist_name,dist_abs,dist_file, andcpanidfields. as well, adownloadfield which can be used as$CPAN/authors/id/$downloadto specify the url of the distribution is provided. if there's only one result found, anamequery based on the matcheddist_nameis performed. one result, different plan, she's versatile bestie π
π SEE ALSO π
CPAN::SQLite::Populate. that's the one. go read her too, she's important.
π AUTHORS π
- Randy Kobes (passed away on September 18, 2010) β rest in peace, legend ποΈ
- Serguei Trouchelle
<stro@cpan.org>
πΈ COPYRIGHT πΈ
Copyright 2006,2008 by Randy Kobes <r.kobes@uwinnipeg.ca>.
Copyright 2011-2013 by Serguei Trouchelle <stro@cpan.org>.
Use and redistribution are under the same terms as Perl itself. the legal tea, served hot β
okay that's the whole page bestie, you're officially educated π
β¨ this was User Contributed Perl Documentation for CPAN::SQLite::Search, brought to you by perl v5.36.0, dated 2022-10-30 β and yes, that's the footer, I folded it in like a cute little sign-off because that's how we do it here. mwah π«Άπ
π¦ where this page comes from
- debian bookworm: libcpan-sqlite-perl 0.220-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcpan-sqlite-perl 0.220-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcpan-sqlite-perl 0.220-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcpan-sqlite-perl 0.220-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcpan-sqlite-perl 0.220-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms