Getopt...::Cache(3pm)
π Getopt...::Cache(3pm) β User Contributed Perl Documentation π
okay bestie, welcome to the lil module that keeps your tab-completion from being slow and embarrassing. it's Getopt...::Cache(3pm), and yes the manual name is literally part of the vibe here. let's go π¦
β¨ NAME β¨
Getopt...::Cache β wait no, the name is Getopt::Complete::Cache, and it does exactly one iconic thing: it caches options next-to the command they apply-to. that's it. that's the whole flex. π
πΈ VERSION πΈ
This document describes Getopt::Complete::Cache 0.26. periodt. π
π SYNOPSIS π
Picture it: MyApp.pm isa Command, and "myapp" is an executable that looks like this, bestie:
use MyApp;
MyApp->execute_with_shell_params_and_exit();
Now here's the move β you add this BEFORE using the MyApp module. like, before. not after. order matters, iykyk:
use Getopt::Complete::Cache class => 'MyApp';
use MyApp;
MyApp->execute_with_shell_params_and_exit();
and now?? the shell will go looking for MyApp.pm.opts during completion, and it will never actually load the MyApp.pm module during tab-completion. not once. never. slay. π
also the .opts file is autogenerated the very first time something tries to find it. it just appears. main character energy fr fr β¨
π«Ά DESCRIPTION π«Ά
so this module is for a very specific, very obscure situation, and honestly? it ate. here's the two conditions:
- the compile time on an executable is sluggish, and we do not want our tab-completion to also be sluggish (nobody has time for that π)
- the command-line should be cached relative to a given module name
this is most useful with classes implementing the Command.pm API. and because those modules can form a whole huge command tree π³, the caching happens at individual levels in the tree, separately. one level at a time, each doing its own lil thing. no cap.
lowkey the whole point is: fast completion, no module loading, and it all lives right next to where the command lives. obsessed.
and that's the whole page, bestie!! this gem was written by the User Contributed Perl Documentation crew, and it's from perl v5.36.0, dated 2022-10-13, and it's Getopt...::Cache(3pm) all the way down. go forth and tab-complete without shame πβ¨ππ¦πΈπ
π¦ where this page comes from
- ubuntu noble: libgetopt-complete-perl 0.26-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgetopt-complete-perl 0.26-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgetopt-complete-perl 0.26-4 Β· 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