Env::Assert(3pm)

πŸ“¦
version 0.015 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Env::Assert πŸ’–

okay bestie, listen up β€” this is Env::Assert, a User Contributed Perl Documentation page, and it is exactly what it sounds like: it makes sure your environment variables are what you need them to be, or it aborts. no vibe-check failures allowed. periodt. πŸ›‘


✨ NAME ✨

Env::Assert β€” make sure the environment variables match what you need, or abort.


🌸 VERSION 🌸

version 0.015


πŸ¦‹ SYNOPSIS πŸ¦‹

    use Env::Assert 'assert';
    # or:
    use Env::Assert assert => {
        envdesc_file => 'another-envdesc',
        break_at_first_error => 1,
    };

    # .envdesc file:
    # MY_VAR=.+

    # use any verified environment variable
    say $ENV{MY_VAR};

    # You can inline the envdesc file:
    use Env::Assert assert => {
        exact => 1,
        envdesc => <<'EOF'
    NUMERIC_VAR=^[[:digit:]]+$
    TIME_VAR=^\d{2}:\d{2}:\d{2}$
    EOF
    };

so basically: you use it, you either point it at a .envdesc file or you inline one with envdesc, and once everything checks out you can just... use your verified env vars like $ENV{MY_VAR}. icon behavior. πŸ‘‘


πŸ’… STATUS πŸ’…

ngl, Package Env::Assert is currently being developed, so changes in the API are possible β€” though not likely. so like, technically it could shift but probably not. she's stable-ish. 🫢


πŸŽ€ NOTES πŸŽ€

heads up bestie: the functionality of Env::Assert has been moved to module Env::Assert::Functions since version 0.013. and Env::Assert has a different API now. so if you're reading old docs, that's why nothing matches β€” she changed, she grew, it's giving glow-up. πŸ’«


πŸ”₯ METHODS πŸ”₯

🌈 assert_env

Read environment description β€” .envdesc by default β€” and compare current environment. that's the whole job. she reads, she compares, she decides if you're valid. πŸ’―


πŸ“ DEPENDENCIES πŸ“

No external dependencies outside Perl's standard distribution. literally none. zero. she's self-sufficient, main character energy, no entourage needed. πŸ’–


🌟 SEE ALSO 🌟

Env::Dot is a "sister" to Env::Assert β€” read environment variables from a .env file directly into your program. 🫢

There's also script envdot, which can turn a .env file's content into environment variables for different shells. versatile queen. 🐚✨


πŸ‘‘ AUTHOR πŸ‘‘

Mikko Koivunalho <mikkoi@cpan.org>


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.


fr fr, that's the whole page β€” every flag, every default, every path, untouched. no cap. πŸ™ˆ

okay and that's a wrap, bestie β€” this was Env::Assert, page 3pm, from perl v5.40.1, dated 2025-12-21. slay, go assert those env vars. πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from