Venus::Vars

Vars Class

Vars Class for Perl 5

method: default method: exists method: get method: name method: new method: set method: unnamed

package main;

use Venus::Vars;

my $vars = Venus::Vars->new(
  value => { USER => 'awncorp', HOME => '/home/awncorp', },
  named => { iam => 'USER', root => 'HOME', },
);

# $vars->root; # $ENV{HOME}
# $vars->home; # $ENV{HOME}
# $vars->get('home'); # $ENV{HOME}
# $vars->get('HOME'); # $ENV{HOME}

# $vars->iam; # $ENV{USER}
# $vars->user; # $ENV{USER}
# $vars->get('user'); # $ENV{USER}
# $vars->get('USER'); # $ENV{USER}

This package provides methods for accessing %ENV items.

Venus::Kind::Utility

Venus::Role::Accessible Venus::Role::Buildable Venus::Role::Proxyable Venus::Role::Valuable

named: rw, opt, HashRef, {}

The default method returns the default value, i.e. {%ENV}.

default() (hashref)

{ since => '0.01', }

=example-1 default

# given: synopsis;

my $default = $vars->default;

# { USER => 'awncorp', HOME => '/home/awncorp', ... }

The exists method takes a name or index and returns truthy if an associated value exists.

exists(string $key) (boolean)

{ since => '0.01', }

=example-1 exists

# given: synopsis;

my $exists = $vars->exists('iam');;

# 1

The get method takes a name or index and returns the associated value.

get(string $key) (any)

{ since => '0.01', }

=example-1 get

# given: synopsis;

my $get = $vars->get('iam');

# "awncorp"

The name method takes a name or index and returns index if the the associated value exists.

name(string $key) (string | undef)

{ since => '0.01', }

=example-1 name

# given: synopsis;

my $name = $vars->name('iam');

# "USER"

The new method constructs an instance of the package.

new(any @args) (Venus::Vars)

{ since => '4.15', }

The set method takes a name or index and sets the value provided if the associated argument exists.

set(string $key, any $value) (any)

{ since => '0.01', }

=example-1 set

# given: synopsis;

my $set = $vars->set('iam', 'root');

# "root"

The unnamed method returns an arrayref of values which have not been named using the named attribute.

unnamed() (hashref)

{ since => '0.01', }

=example-1 unnamed

package main;

use Venus::Vars;

my $vars = Venus::Vars->new(
  value => { USER => 'awncorp', HOME => '/home/awncorp', },
  named => { root => 'HOME', },
);

my $unnamed = $vars->unnamed;

# { USER => "awncorp" }

t/Venus.t: present: authors t/Venus.t: present: license

46 POD Errors

The following errors were encountered while parsing the POD:

Around line 14:

Unknown directive: =name

Around line 22:

Unknown directive: =tagline

Around line 30:

Unknown directive: =abstract

Around line 38:

Unknown directive: =includes

Around line 52:

Unknown directive: =synopsis

Around line 85:

Unknown directive: =description

Around line 93:

Unknown directive: =inherits

Around line 101:

Unknown directive: =integrates

Around line 112:

Unknown directive: =attributes

Around line 120:

Unknown directive: =method

Around line 124:

Unknown directive: =signature

Around line 128:

Unknown directive: =metadata

Around line 152:

Unknown directive: =method

Around line 157:

Unknown directive: =signature

Around line 161:

Unknown directive: =metadata

Around line 193:

=cut found outside a pod block. Skipping to next block.

Around line 211:

=cut found outside a pod block. Skipping to next block.

Around line 229:

=cut found outside a pod block. Skipping to next block.

Around line 239:

Unknown directive: =method

Around line 243:

Unknown directive: =signature

Around line 247:

Unknown directive: =metadata

Around line 279:

=cut found outside a pod block. Skipping to next block.

Around line 297:

=cut found outside a pod block. Skipping to next block.

Around line 315:

=cut found outside a pod block. Skipping to next block.

Around line 325:

Unknown directive: =method

Around line 330:

Unknown directive: =signature

Around line 334:

Unknown directive: =metadata

Around line 366:

=cut found outside a pod block. Skipping to next block.

Around line 384:

=cut found outside a pod block. Skipping to next block.

Around line 402:

=cut found outside a pod block. Skipping to next block.

Around line 412:

Unknown directive: =method

Around line 416:

Unknown directive: =signature

Around line 420:

Unknown directive: =metadata

Around line 438:

=cut found outside a pod block. Skipping to next block.

Around line 460:

=cut found outside a pod block. Skipping to next block.

Around line 484:

=cut found outside a pod block. Skipping to next block.

Around line 497:

Unknown directive: =method

Around line 502:

Unknown directive: =signature

Around line 506:

Unknown directive: =metadata

Around line 538:

=cut found outside a pod block. Skipping to next block.

Around line 556:

=cut found outside a pod block. Skipping to next block.

Around line 574:

=cut found outside a pod block. Skipping to next block.

Around line 584:

Unknown directive: =method

Around line 589:

Unknown directive: =signature

Around line 593:

Unknown directive: =metadata

Around line 624:

Unknown directive: =partials