Alt::Assert(3pm)

πŸ“¦
version 0.19 Β· 2 versions
  • 0.19 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.19 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 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