System...utoLoad(3pm)
π System::Sub::AutoLoad π
okay bestie, so this is a page from the User Contributed Perl Documentation, and the whole vibe is: System::Sub::AutoLoad β aka the module that turns your random unknown subs into actual external commands like it's nothing. no cap. π¦
β¨ NAME β¨
System::Sub::AutoLoad β auto-wrap external commands as DWIM subs π«Ά
πΈ VERSION πΈ
version 0.162800 β¨
π SYNOPSIS π
π Basic usage
Any unknown sub will become a System::Sub. literally any of them. it's giving main character energy.
use System::Sub::AutoLoad;
my $hostname = hostname();
π¦ Usage with forward declaration
Allows to avoid using parentheses. System::Sub import stays lazy. so chill, it's not doing work until it has to π
use System::Sub::AutoLoad qw(hostname);
my $hostname = hostname;
π Usage with forward declaration command options
Options definitions will be checked lazily at the first call to the AUTOLOAD for that sub. yes bestie, lazily. we love a procrastination icon.
use System::Sub::AutoLoad hostname => [ 0 => '/bin/hostname' ];
my $hostname = hostname;
π DESCRIPTION π
Any unknown sub in your code will be transformed into a System::Sub at its first call. This is lazy <http://en.wikipedia.org/wiki/Lazy_evaluation> import for System::Sub. π₯
To avoid using parentheses after the sub name, you usually have to predeclare the sub with either a forward declaration (a sub without body such as sub foo;) or with the subs module. But with Sytem::Sub::AutoLoad you can simply list the subs names on the use line and that will be done for you. no extra steps, no drama, periodt. π
You can also pass System::Sub options to the sub, but they will be lazily analysed: this is the full System::Sub power, but with lazy import. the way that it gives you everything and still does nothing until you ask?? iconic. β
π§ Implementation details
This module exports an AUTOLOAD sub that will import the sub with System::Sub at its first call. that's the whole magic trick, bestie, that's the tea π
π AUTHOR π
Olivier MenguΓ©, dolmen@cpan.org. shoutout to the legend π
π COPYRIGHT & LICENSE π
Copyright Β© 2012 Olivier MenguΓ©.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. so go off, redistribute responsibly π«Ά
fr fr, that's the whole page β nothing skipped, nothing made up, all the details kept exactly as they came. iykyk. πβ¨
signing off from perl v5.36.0, dated 2022-12-06 β mwah, stay lazy (in the good way) ππΈ
π¦ where this page comes from
- debian bookworm: libsystem-sub-perl 0.162800-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsystem-sub-perl 0.162800-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsystem-sub-perl 0.162800-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libsystem-sub-perl 0.162800-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms