CPAN::...::META(3pm)

πŸ“¦
version 0.220 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, gather round β€” this is CPAN::SQLite::META, and she's the little helper module that makes CPAN.pm and CPAN::SQLite get along. no cap. it's the matchmaker, the group-chat admin, the one doing the behind-the-scenes work so everyone else can shine. πŸ‘‘


✨ VERSION ✨

this is version 0.220. periodt. πŸŽ€


🌸 DESCRIPTION 🌸

so like, real talk: this module has no direct public interface. she's not here for randoms. she's a helper module, designed for CPAN::SQLite to be used inside the CPAN.pm module. iykyk. πŸ¦‹

you make a new object like this:

my $obj = CPAN::SQLite::META->new($CPAN::META);

where $CPAN::META comes from CPAN.pm. and then boom β€” you've got two main methods to play with. πŸ’…

🫢 set

it's used like this:

$obj->set($class, $id);

where $class is one of CPAN::Author, CPAN::Module, or CPAN::Distribution, and $id is the id CPAN.pm uses to identify the class. πŸ’–

what does it do? it searches the CPAN::SQLite database by name, using the appropriate author, dist, or module mode, and if a result is found, it calls

$CPAN::META->instance(
                     $class => $id
                     )->set(
                      %attributes
                     );

to register an instance of this class within CPAN.pm. iconic behaviour honestly.

🌈 ssearch

(yeah, the heading says ssearch, we don't ask questions, we just vibe πŸ™ˆ)

it's used like this:

$obj->search($class, $id);

where $class is one of CPAN::Author, CPAN::Module, or CPAN::Distribution, and $id is the id CPAN.pm uses to identify the class. ✨

this one searches the CPAN::SQLite database by query using the appropriate author, dist, or module mode, and if results are found, it calls

$CPAN::META->instance(
                     $class => $id
                     )->set(
                      %attributes
                     );

for each match to register an instance of this class within CPAN.pm. multiple matches? she's handling all of them, no stress. πŸ’…


the attributes set within $CPAN::META-instance> depend on the particular class. so let's go class by class, bestie. πŸ“š

🧚 author

the attributes are

'FULLNAME' => $results->{fullname},
'EMAIL' => $results->{email},

where $results are the results returned from CPAN::SQLite. simple. clean. slay. ✨

πŸ’œ module

the attributes are

'description' => $results->{mod_abs},
'userid' => $results->{cpanid},
'CPAN_VERSION' => $results->{mod_vers},
'CPAN_FILE' => $results->{download},
'CPAN_USERID' => $results->{cpanid},

where $results are the results returned from CPAN::SQLite. look at that list, she's thorough. πŸ‘‘

πŸ“ dist

the attributes are

'DESCRIPTION' => $results->{dist_abs},
'CPAN_USERID' => $results->{cpanid},
'CPAN_VERSION' => $results->{dist_vers},

as well, a CONTAINSMODS key to $CPAN::META is added, this being a hash reference whose keys are the modules contained within the distribution. so she's not just setting attributes, she's dropping a whole hash ref of receipts. πŸ’–


there's also a method available reload, which rebuilds the database. πŸ› οΈ

it can be used as

$obj->reload(force => 1, time => $time);

so the time option β€” which, if not passed in, will default to the current time β€” gets used to compare the current time to the mtime of the database file. if they differ by more than one day, the database gets rebuilt. πŸ’€

and the <force> option, if given, will force a rebuilding of the database regardless of the time difference. so if you want it rebuilt right now, no waiting around, that's your girl. πŸ”₯

ngl the force option is giving main character energy β€” it does not care about your mtime math, it just rebuilds. 🫢

and that's the whole page, bestie! written by the lovely perl people, perl v5.36.0, dated 2022-10-30 β€” mwah, thank you for coming to my ted talk, drink some water, run your tests, and stan a helper module that stays in her lane. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from