NAME
Venus::Vars - Vars Class
ABSTRACT
Vars Class for Perl 5
SYNOPSIS
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}
DESCRIPTION
This package provides methods for accessing %ENV
items.
ATTRIBUTES
This package has the following attributes:
named
named(HashRef)
This attribute is read-write, accepts (HashRef)
values, is optional, and defaults to {}
.
INHERITS
This package inherits behaviors from:
INTEGRATES
This package integrates behaviors from:
METHODS
This package provides the following methods:
default
default() (hashref)
The default method returns the default value, i.e. {%ENV}
.
Since 0.01
- default example 1
-
# given: synopsis; my $default = $vars->default; # { USER => 'awncorp', HOME => '/home/awncorp', ... }
exists
exists(string $key) (boolean)
The exists method takes a name or index and returns truthy if an associated value exists.
Since 0.01
get
get(string $key) (any)
The get method takes a name or index and returns the associated value.
Since 0.01
name
name(string $key) (string | undef)
The name method takes a name or index and returns index if the the associated value exists.
Since 0.01
set
set(string $key, any $value) (any)
The set method takes a name or index and sets the value provided if the associated argument exists.
Since 0.01
unnamed
unnamed() (hashref)
The unnamed method returns an arrayref of values which have not been named using the named
attribute.
Since 0.01
- unnamed example 1
-
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" }
AUTHORS
Awncorp, awncorp@cpan.org
LICENSE
Copyright (C) 2000, Awncorp, awncorp@cpan.org
.
This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.