Env::A...ctions(3pm)

πŸ“¦ version 0.015, in ubuntu resolute, ubuntu stonking

πŸ’– 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 .env file directly into your program πŸ‘―β€β™€οΈ
  • there's also the script envdot, which can turn a .env file's content into environment variables for different shells. multi-shell slay 🐚

πŸ’– AUTHOR πŸ’–

Mikko Koivunalho <mikkoi@cpan.org> β€” the legend, the icon, the moment πŸ‘‘


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