Env::Assert::Functions(3pm)

NAME
Env::Assert::Functions - The functionality of Env::Assert and bin/envassert.

VERSION
version 0.015

SYNOPSIS
    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'} );
    }

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 this package since version 0.013. Env::Assert has a different API now. It can be used by itself at the start of the program, similar to Env::Dot.

FUNCTIONS
No functions are automatically exported to the calling namespace.

  assert( \%env, \%want, \%params )
Ensure your environment, parameter env (hashref), matches with the environment description, parameter want (hashref). Use parameter params (hashref) to specify processing options.

Supported params:

break_at_first_error
    Verify environment only up until the first error. Then break and return with only that error.

Return: hashref: { success => 1/0, errors => hashref, };

  report_errors( \%errors )
Report errors in a nicely formatted way.

  file_to_desc( @rows )
Extract an environment description from a .envdesc file.

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.