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

NAME

OP::Constants

DESCRIPTION

Loads .oprc values as Perl constants, with optional export.

.oprc is a YAML file containing constant values used by OP. It should be located under $ENV{OP_HOME}, which defaults to /opt/op.

SYNOPSIS

To import constants directly, just specify them when using OP::Constants:

 use OP::Constants qw| dbUser dbPass |;

 my $dbUser = dbUser;
 my $dbPass = dbPass;

To access the constants without importing them into the caller's namespace, just fully qualify them:

 use OP::Constants;

 my $dbUser = OP::Constants::dbUser;
 my $dbPass = OP::Constants::dbPass;

EXAMPLE

The following is an example of an .oprc file. The file contents must be valid YAML.

  ---
  dbHost: localhost
  dbPass: ~
  dbPort: 3306
  dbUser: op
  memcachedHosts:
    - 127.0.0.1:31337
  sqliteRoot: /opt/op/sqlite
  yamlRoot: /opt/op/yaml
  scratchRoot: /tmp
  apiUser: root

REVISION

$Id: //depotit/tools/source/snitchd-0.20/lib/OP/Constants.pm#8 $

SEE ALSO

YAML::Syck, constant

This file is part of OP.