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


Manual Reference Pages  -  HASH::AUTOHASH::ARGS::V0 (3)

.ds Aq ’

NAME

Hash::AutoHash::Args::V0 - Object-oriented processing of argument lists (version 0)

CONTENTS

VERSION

Version 1.18

SYNOPSIS



  use Hash::AutoHash::Args::V0;
  my $args=new Hash::AutoHash::Args::V0(name=>Joe,
                                      HOBBIES=>hiking,hobbies=>cooking);

  # access argument values as HASH elements
  my $name=$args->{name};
  my $hobbies=$args->{hobbies};

  # access argument values via methods
  my $name=$args->name;
  my $hobbies=$args->hobbies;

  # set local variables from argument values -- three equivalent ways
  use Hash::AutoHash::Args qw(autoargs_get);
  my($name,$hobbies)=@$args{qw(name hobbies)};
  my($name,$hobbies)=autoargs_get($args,qw(name hobbies));
  my($name,$hobbies)=$args->get_args(qw(name hobbies)));

  # copy args into local hash
  my %args=$args->getall_args

  # alias $args to regular hash for more concise hash notation
  use Hash::AutoHash::Args qw(autoargs_alias);
  autoargs_alias($args,%args);
  my($name,$hobbies)=@args{qw(name hobbies)}; # get argument values
  $args{name}=Joseph;                       # set argument value



DESCRIPTION

This class simplifies the handling of keyword argument lists. It replaces Class::AutoClass::Args. It is a subclass of Hash::AutoHash::Args providing almost complete compatibility with Class::AutoClass::Arg. We recommend that you use Hash::AutoHash::Args instead of this class unless you need compatibility with Class::AutoClass::Args.

This class is identical to Hash::AutoHash::Args except as follows. Please refer to Hash::AutoHash::Args for the main documentation.

Unlike Hash::AutoHash::Args, this class defines several methods and functions in its own namespace.



  get_args, getall_args, set_args, fix_args, _fix_args, fix_keyword,
  fix_keywords, is_keyword, is_positional



A consequence of these being defined in the class’s namespace is that they mask keywords of the same name and prevent those keywords from being accessed using method notation. In Hash::AutoHash::Args, these are provided as functions that can be imported in the caller’s namespace which avoids the masking problem.

get_args, getall_args, and set_args are methods that can be invoked on Hash::AutoHash::Args::V0 objects. Descriptions of these methods are below. The others are functions and operate the same way here as in Hash::AutoHash::Args except that they do not need to be imported before use.



 Title   : get_args
 Usage   : ($name,$hobbies)=$args->get_args(qw(-name hobbies))
 Function: Get values for multiple keywords
 Args    : array or ARRAY of keywords
 Returns : array or ARRAY of argument values
 Note    : provided in Hash::AutoHash::Args as importable function

 Title   : getall_args
 Usage   : %args=$args->getall_args;
 Function: Get all keyword, value pairs
 Args    : none
 Returns : hash or HASH of key=>value pairs.
 Note    : provided in Hash::AutoHash::Args as importable function

 Title   : set_args
 Usage   : $args->set_args
             (name=>Joe the Plumber,-first_name=>Joe,-last_name=>Plumber)
 Function: Set multiple arguments in existing object
 Args    : parameter list in same format as for new
 Returns : nothing
 Note    : provided in Hash::AutoHash::Args as importable function



DIFFERENCES FROM Class::AutoClass::Args

This class differs from its precursor, Class::AutoClass::Args, only in a bug fix involving get_args in scalar context.

In scalar context, get_args is supposed to return an ARRAY of argument values. Instead, in Class::AutoClass::Args, it returned the value of the first argument.



  my $values=$args->get_args(qw(name hobbies)); # old bug: gets value of name



The bug has been fixed and it now returns an ARRAY of the requested argument values.



  my $values=get_args($args,qw(name hobbies));  # now: gets ARRAY of both values



SEE ALSO

Hash::AutoHash::Args is the base class of this one. Class::AutoClass::Args is replaced by this class.

Hash::AutoHash provides the object wrapper used by this class. Hash::AutoHash::MultiValued, Hash::AutoHash::AVPairsSingle, Hash::AutoHash::AVPairsMulti, Hash::AutoHash::Record are other subclasses of Hash::AutoHash.

perltie and Tie::Hash present background on tied hashes.

AUTHOR

Nat Goodman, <natg at shore.net>

KNOWN BUGS AND CAVEATS

CPAN reports that Make test fails under Perl 5.6.2, FreeBSD 5.2.1. for the predecessor to this class, Class::AutoClass::Args. We are not aware of any bugs in this class.

    Bugs, Caveats, and ToDos

See caveats about accessing arguments via method notation.

SUPPORT

You can find documentation for this module with the perldoc command.



    perldoc Hash::AutoHash::Args::V0



You can also look for information at:
o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hash-AutoHash-Args-V0>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Hash-AutoHash-Args-V0>

o CPAN Ratings

<http://cpanratings.perl.org/d/Hash-AutoHash-Args-V0>

o Search CPAN

<http://search.cpan.org/dist/Hash-AutoHash-Args-V0/>

COPYRIGHT & LICENSE

Copyright (c) 2008, 2009 Institute for Systems Biology (ISB). All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

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


perl v5.20.3 HASH::AUTOHASH::ARGS::V0 (3) 2016-03-17

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