Alt::Assert(3pm)
π Alt::Assert β the vibe check for your alternate modules π
Alt::Assert Β· user contributed perl documentation Β· perl v5.36.0
okay bestie so picture this: you've got a module, and there's a whole alternate implementation of it floating around, and you need to be absolutely sure you got the right one. that's literally this. that's the whole thing. π«Ά
β¨ NAME β¨
Alt::Assert β assert alternate module implementation. yes that's it, that's the job, she's an assert-er π
πΈ SYNOPSIS πΈ
okay so imagine there's a CPAN module called Foo::Bar (classic), and mst wants to write an ALTernate called Alt::Foo::Bar::MSTROUT. iconic behavior honestly π
in mst's Foo::Bar, there's this line:
use constant ALT => 'MSTROUT';
and in the alt module:
package Alt::Foo::Bar::MSTROUT;
use Alt::Assert; # imports assert()
1;
meanwhile the users?? they just use mst's Foo::Bar like normal, exactly like they'd use the original Foo::Bar:
use Foo::Bar -various => [qw(weird import)], {API=>'things'};
or:
require Foo::Bar;
and if they wanna assert they've got the mst version (main character energy tbh), they can do:
use Foo::Bar -various => [qw(weird import)], {API=>'things'};
use Alt::Foo::Bar::MSTROUT;
or:
require Foo::Bar;
require Alt::Foo::Bar::MSTROUT;
Alt::Foo::Bar::MSTROUT->assert;
no cap, that's the whole flow π
π¦ DESCRIPTION π¦
Alt::Assert can be used to assert that the loaded module is the wanted alternate implementation. π
using the synopsis' example: there can be different Foo::Bar installed, either from the original distribution, or from one of the alternate ones. each alternate might be slightly incompatible with the original. π
and here's the tea β the existence of Alt::Foo::Bar::MSTROUT in the installation does not necessarily ensure that the installed Foo::Bar is from the same alternate distribution, because an installer can replace Foo::Bar from another distribution. π
that's why one might need to do this assertion. it's giving "trust but verify" fr fr.
π SEE ALSO π
- Alt β go look at it bestie, it's right there
π AUTHOR π
Ingy dΓΆt Net <ingy@cpan.org> β absolute legend, we stan π«Ά
β COPYRIGHT β
Copyright 2012-2014. Ingy dΓΆt Net.
See <http://www.perl.com/perl/misc/Artistic.html>
and that's the whole page babes β¨ this was Alt::Assert(3pm) from the user contributed perl documentation, running on perl v5.36.0, dated 2022-11-27 β mwah, slay, bye π ππΈ
π¦ where this page comes from
- debian bookworm: libalt-perl 0.19-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libalt-perl 0.19-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libalt-perl 0.19-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalt-perl 0.19-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalt-perl 0.19-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