GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Venus::Vars(3) User Contributed Perl Documentation Venus::Vars(3)

Venus::Vars - Vars Class

Vars Class for Perl 5

  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.

This package has the following attributes:

  named(HashRef)

This attribute is read-write, accepts "(HashRef)" values, is optional, and defaults to "{}".

This package inherits behaviors from:

Venus::Kind::Utility

This package integrates behaviors from:

Venus::Role::Accessible

Venus::Role::Buildable

Venus::Role::Proxyable

Venus::Role::Valuable

This package provides the following methods:

  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(string $key) (boolean)

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

Since 0.01

exists example 1
  # given: synopsis;
  my $exists = $vars->exists('iam');;
  # 1
    
exists example 2
  # given: synopsis;
  my $exists = $vars->exists('USER');;
  # 1
    
exists example 3
  # given: synopsis;
  my $exists = $vars->exists('PATH');
  # undef
    
exists example 4
  # given: synopsis;
  my $exists = $vars->exists('user');
  # 1
    

  get(string $key) (any)

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

Since 0.01

get example 1
  # given: synopsis;
  my $get = $vars->get('iam');
  # "awncorp"
    
get example 2
  # given: synopsis;
  my $get = $vars->get('USER');
  # "awncorp"
    
get example 3
  # given: synopsis;
  my $get = $vars->get('PATH');
  # undef
    
get example 4
  # given: synopsis;
  my $get = $vars->get('user');
  # "awncorp"
    

  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

name example 1
  # given: synopsis;
  my $name = $vars->name('iam');
  # "USER"
    
name example 2
  # given: synopsis;
  my $name = $vars->name('USER');
  # "USER"
    
name example 3
  # given: synopsis;
  my $name = $vars->name('PATH');
  # undef
    
name example 4
  # given: synopsis;
  my $name = $vars->name('user');
  # "USER"
    

  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

set example 1
  # given: synopsis;
  my $set = $vars->set('iam', 'root');
  # "root"
    
set example 2
  # given: synopsis;
  my $set = $vars->set('USER', 'root');
  # "root"
    
set example 3
  # given: synopsis;
  my $set = $vars->set('PATH', '/tmp');
  # undef
    
set example 4
  # given: synopsis;
  my $set = $vars->set('user', 'root');
  # "root"
    

  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" }
    

Awncorp, "awncorp@cpan.org"

Copyright (C) 2022, 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.

2023-11-27 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.