Env::A...ctions(3pm)
π NAME π
Env::Assert::Functions β bestie, this is literally the whole personality of Env::Assert and its lil command-line sidekick bin/envassert, all packaged up and ready to go π
(it's a Perl module page, btw β User Contributed Perl Documentation energy, and the manual name is Env::A...ctions(3pm) in case you were squinting at the tab bar π)
β¨ VERSION β¨
version 0.015 β she's fresh, she's numbered, she's serving πΈ
π¦ SYNOPSIS π¦
okay so here's the whole vibe in code, no notes:
use Env::Assert::Functions qw( assert report_errors );
my %want = (
options => {
exact => 1,
},
variables => {
USER => { regexp => '^[[:word:]]{1}$', required => 1 },
},
);
my %parameters;
$parameters{'break_at_first_error'} = 1;
my $r = assert( \%ENV, \%want, \%parameters );
if( ! $r->{'success'} ) {
print report_errors( $r->{'errors'} );
}
see how she eats? π
you describe what your environment should look like, you hand her your %ENV, and she tells you if reality is matching the vision β¨
π STATUS π
so like, Package Env::Assert is currently being developed β meaning changes in the API are possible, though not likely. not likely, bestie. she's basically stable, she's just keeping her options open π
π NOTES π
- Functionality of Env::Assert has been moved to this package since version
0.013. like, she packed her bags and moved out π§³ - Env::Assert has a different API now. glow-up era β¨
- It can be used by itself at the start of the program, similar to Env::Dot.</seach> main character energy fr fr.
π₯ FUNCTIONS π₯
heads up babes: No functions are automatically exported to the calling namespace. you gotta ask for them. consent is key π«Ά
π assert( \%env, \%want, \%params ) π
okay so this is THE function. she ensures your environment β that's the parameter env (a hashref) β matches up with the environment description, which is the parameter want (also a hashref). then you use the parameter params (hashref, yes another one) to specify your processing options π
Supported params:
break_at_first_errorβ verify the environment only up until the first error. then break and return with only that error. like, she stops at the first red flag, she does not keep scrolling π
Return: a hashref that looks like this:
{ success => 1/0, errors => hashref, };
so success is your vibe check (1 or 0) and errors is a whole hashref of receipts π
πΈ report_errors( \%errors ) πΈ
report errors in a nicely formatted way. that's it, that's the whole thing β she makes the errors pretty β¨ because reading raw error dumps is giving unhinged, and we don't do that here π
π file_to_desc( @rows ) π
extract an environment description from a .envdesc file. like, she reads the rows and pulls the desc out. iconique π¦
π DEPENDENCIES π
No external dependencies outside Perl's standard distribution. she's self-sufficient, she brought her own snacks, she needs nobody π«Άβ¨
β SEE ALSO β
- Env::Dot is a "sister" to Env::Assert. read environment variables from a
.envfile directly into your program π―ββοΈ - there's also the script
envdot, which can turn a.envfile's content into environment variables for different shells. multi-shell slay π
π AUTHOR π
Mikko Koivunalho <mikkoi@cpan.org> β the legend, the icon, the moment π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2023 by Mikko Koivunalho.
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, go off bestie, do your thing π
and that's the whole page, no cap π§ generated from perl v5.40.1, dated 2025-12-21 β stay hydrated, read your manpages, and may your environment variables always be exactly what you described ππβ¨
π¦ where this page comes from
- ubuntu resolute: env-assert 0.015-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: env-assert 0.015-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