Scroll to navigation

Env::Assert(3pm) User Contributed Perl Documentation Env::Assert(3pm)

NAME

Env::Assert - Ensure that 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
    };

STATUS

Package Env::Assert is currently being developed so changes in the API are possible, though not likely.

NOTES

Functionality of Env::Assert has been moved to module Env::Assert::Functions since version 0.013. Env::Assert has a different API now.

METHODS

assert_env

Read environment description, .envdesc by default, and compare current environment.

DEPENDENCIES

No external dependencies outside Perl's standard distribution.

SEE ALSO

Env::Dot is a "sister" to Env::Assert. Read environment variables from a .env file directly into you program. There is also script envdot which can turn .env file's content into environment variables for different shells.

AUTHOR

Mikko Koivunalho <mikkoi@cpan.org>

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.

2025-12-21 perl v5.40.1