Perl::...ontext(3pm)
β¨ NAME β¨
Perl::PrereqScanner::NotQuiteLite::Context β it's a 3pm (User Contributed Perl Documentation) page, bestie, and it's the little context object that holds all the receipts while your scanner works its way through a file. π
πΈ DESCRIPTION πΈ
Okay so picture it: this thing is typically used to keep callbacks, an eval state, and the found prerequisites for a processing file. That's the whole job. It's the group chat where everything gets logged. πβ¨
π METHODS π
π add
$c->add($module);
$c->add($module => $minimum_version);
This adds a module β with or without a minimum version β as either a requirement or a suggestion, and which one it lands as depends entirely on the eval state, no cap. You can add the same module with different versions as many times as you wish, queen, it does not care. The actual minimum version for the module gets calculated on the inside (by CPAN::Meta::Requirements). It's giving teamwork. π«Ά
π§ register_keyword_parser, remove_keyword_parser, register_method_parser, register_sub_parser
$c->register_keyword_parser(
'func_name',
[$parser_class, 'parser_for_the_func', $used_module],
);
$c->remove_keyword_parser('func_name');
$c->register_method_parser(
'method_name',
[$parser_class, 'parser_for_the_method', $used_module],
);
So here's the scenario: you find a module that can export a loader function and it's actually used β think Moose, which can export an extends function that will load a module internally. In that case you might also want to register the loader function as a custom keyword dynamically, so the scanner can also run a callback for that function and parse its argument tokens. Dynamic. Iconic. β¨
You can also remove the keyword when you find the module's been noed (and when the module supports unimport). Bye bestie. π
You can also register a method callback on the fly β but you can't remove it. That one's forever. π
If you always want to check some functions/methods whenever you load a plugin, just register them using a register method in the plugin. Easy. Done. Slay. π
β requires
Returns a CPAN::Meta::Requirements object for requirements. That's it, that's the whole text. π§Ύ
π suggests
Returns a CPAN::Meta::Requirements object for suggestions (these are the requirements that live inside evals) β or undef when it's not expected to parse tokens in eval. Knowing the difference is the whole vibe check here. π¦
π METHODS MOSTLY FOR INTERNAL USE π
π new
Creates an instance. You usually don't need to call this, bestie, because it's automatically created in the scanner. It just shows up. Main character energy. π
π₯ has_callbacks, has_callback_for, run_callback_for
next unless $c->has_callbacks('use');
next unless $c->has_callbacks_for('use', 'base');
$c->run_callbacks_for('use', 'base', $tokens);
Let's break it down:
has_callbacksreturns true if a callback foruse,no,keyword, ormethodis registered.has_callbacks_forreturns true if a callback for the module/keyword/method is registered.run_callbacks_foris the one that actually runs the callback. Get it, do it. π«
π has_added
Returns true if a module has already been added as a requirement or a suggestion. Only useful for the ::UniversalVersion plugin β like, it's a very specific tool for a very specific situation, iykyk. π
π AUTHOR π
Kenichi Ishigaki, <ishigaki@cpan.org> β the author, the legend, the moment. π
πΈ COPYRIGHT AND LICENSE πΈ
This software is copyright (c) 2015 by Kenichi Ishigaki.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free as in freedom, periodt. ποΈ
And that's a wrap on this Perl::...ontext(3pm) page from perl v5.40.1, dated 2026-04-21. Go forth and scan those prereqs, bestie π
πβ¨
π¦ where this page comes from
- ubuntu stonking: libperl-prereqscanner-notquitelite-perl 0.9918-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