The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Test::Requires::Env - Testing environments and skipping by result of the testing


  use Test::More;
  use Test::Requires::Env;

  $ENV{SHELL} = '/bin/zsh';

      'SHELL'   => '/bin/bash',
      'INCLUDE' => qr{/usr/local/include},
      'LIB'     => qr{/usr/local/lib},

  fail 'Do not reach here';


Test::Requires::Env is testing environments and skipping by result of the testing. This module exports 'test_environments()' sub routine.

The sub routine accepts two type arguments. One of them is array of environment names, it is used to check existing such a environment. Other one is hash reference of environment conditions, it is used to check environment value by equals or regexp.

And this module provides short cut of test_environments() sub routine by import method looks like synopsis.


test_environments( @entries )

@entries items should be scalar or hash reference. The scalar is treated as environment name, and check which the specified environment is existing or not in environments.

The hash reference is consisted of environment name is key, environment value condition is value. The environment value condition accepts scalar and regexp.

The condition scalar is used by which the scalar equals actual environment value or not. The condition regexp is used by matching to actual environment value.


Toru Yamaguchi <>



This module is expired Test::Requires.



This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.