Venus::Vars

Vars Class

Vars Class for Perl 5

method: default method: exists method: get method: name 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(Str $key) (Bool)

{ 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(Str $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(Str $key) (Str | Undef)

{ since => '0.01', }

=example-1 name

# given: synopsis;

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

# "USER"

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

set(Str $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: pdml: authors t/Venus.t: pdml: license

40 POD Errors

The following errors were encountered while parsing the POD:

Around line 13:

Unknown directive: =name

Around line 21:

Unknown directive: =tagline

Around line 29:

Unknown directive: =abstract

Around line 37:

Unknown directive: =includes

Around line 50:

Unknown directive: =synopsis

Around line 83:

Unknown directive: =description

Around line 91:

Unknown directive: =inherits

Around line 99:

Unknown directive: =integrates

Around line 110:

Unknown directive: =attributes

Around line 118:

Unknown directive: =method

Around line 122:

Unknown directive: =signature

Around line 126:

Unknown directive: =metadata

Around line 150:

Unknown directive: =method

Around line 155:

Unknown directive: =signature

Around line 159:

Unknown directive: =metadata

Around line 191:

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

Around line 209:

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

Around line 227:

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

Around line 237:

Unknown directive: =method

Around line 241:

Unknown directive: =signature

Around line 245:

Unknown directive: =metadata

Around line 277:

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

Around line 295:

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

Around line 313:

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

Around line 323:

Unknown directive: =method

Around line 328:

Unknown directive: =signature

Around line 332:

Unknown directive: =metadata

Around line 364:

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

Around line 382:

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

Around line 400:

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

Around line 410:

Unknown directive: =method

Around line 415:

Unknown directive: =signature

Around line 419:

Unknown directive: =metadata

Around line 451:

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

Around line 469:

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

Around line 487:

=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 537:

Unknown directive: =partials