Marcel Grünauer > Dist-Joseki-0.20 > Dist::Joseki::Cmd::Command

Download:
Dist-Joseki-0.20.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.20   Source  

NAME ^

Dist::Joseki::Cmd::Command - Base class for Dist::Joseki::Cmd commands

SYNOPSIS ^

    Dist::Joseki::Cmd::Command->new;

DESCRIPTION ^

None yet.

METHODS ^

args
    my @values    = $obj->args;
    my $array_ref = $obj->args;
    $obj->args(@values);
    $obj->args($array_ref);

Get or set the array values. If called without an arguments, it returns the array in list context, or a reference to the array in scalar context. If called with arguments, it expands array references found therein and sets the values.

args_clear
    $obj->args_clear;

Deletes all elements from the array.

args_count
    my $count = $obj->args_count;

Returns the number of elements in the array.

args_index
    my $element   = $obj->args_index(3);
    my @elements  = $obj->args_index(@indices);
    my $array_ref = $obj->args_index(@indices);

Takes a list of indices and returns the elements indicated by those indices. If only one index is given, the corresponding array element is returned. If several indices are given, the result is returned as an array in list context or as an array reference in scalar context.

args_pop
    my $value = $obj->args_pop;

Pops the last element off the array, returning it.

args_push
    $obj->args_push(@values);

Pushes elements onto the end of the array.

args_set
    $obj->args_set(1 => $x, 5 => $y);

Takes a list of index/value pairs and for each pair it sets the array element at the indicated index to the indicated value. Returns the number of elements that have been set.

args_shift
    my $value = $obj->args_shift;

Shifts the first element off the array, returning it.

args_splice
    $obj->args_splice(2, 1, $x, $y);
    $obj->args_splice(-1);
    $obj->args_splice(0, -1);

Takes three arguments: An offset, a length and a list.

Removes the elements designated by the offset and the length from the array, and replaces them with the elements of the list, if any. In list context, returns the elements removed from the array. In scalar context, returns the last element removed, or undef if no elements are removed. The array grows or shrinks as necessary. If the offset is negative then it starts that far from the end of the array. If the length is omitted, removes everything from the offset onward. If the length is negative, removes the elements from the offset onward except for -length elements at the end of the array. If both the offset and the length are omitted, removes everything. If the offset is past the end of the array, it issues a warning, and splices at the end of the array.

args_unshift
    $obj->args_unshift(@values);

Unshifts elements onto the beginning of the array.

clear_args
    $obj->clear_args;

Deletes all elements from the array.

clear_opt
    $obj->clear_opt;

Deletes all keys and values from the hash.

count_args
    my $count = $obj->count_args;

Returns the number of elements in the array.

delete_opt
    $obj->delete_opt(@keys);

Takes a list of keys and deletes those keys from the hash.

exists_opt
    if ($obj->exists_opt($key)) { ... }

Takes a key and returns a true value if the key exists in the hash, and a false value otherwise.

index_args
    my $element   = $obj->index_args(3);
    my @elements  = $obj->index_args(@indices);
    my $array_ref = $obj->index_args(@indices);

Takes a list of indices and returns the elements indicated by those indices. If only one index is given, the corresponding array element is returned. If several indices are given, the result is returned as an array in list context or as an array reference in scalar context.

keys_opt
    my @keys = $obj->keys_opt;

Returns a list of all hash keys in no particular order.

opt
    my %hash     = $obj->opt;
    my $hash_ref = $obj->opt;
    my $value    = $obj->opt($key);
    my @values   = $obj->opt([ qw(foo bar) ]);
    $obj->opt(%other_hash);
    $obj->opt(foo => 23, bar => 42);

Get or set the hash values. If called without arguments, it returns the hash in list context, or a reference to the hash in scalar context. If called with a list of key/value pairs, it sets each key to its corresponding value, then returns the hash as described before.

If called with exactly one key, it returns the corresponding value.

If called with exactly one array reference, it returns an array whose elements are the values corresponding to the keys in the argument array, in the same order. The resulting list is returned as an array in list context, or a reference to the array in scalar context.

If called with exactly one hash reference, it updates the hash with the given key/value pairs, then returns the hash in list context, or a reference to the hash in scalar context.

opt_clear
    $obj->opt_clear;

Deletes all keys and values from the hash.

opt_delete
    $obj->opt_delete(@keys);

Takes a list of keys and deletes those keys from the hash.

opt_exists
    if ($obj->opt_exists($key)) { ... }

Takes a key and returns a true value if the key exists in the hash, and a false value otherwise.

opt_keys
    my @keys = $obj->opt_keys;

Returns a list of all hash keys in no particular order.

opt_values
    my @values = $obj->opt_values;

Returns a list of all hash values in no particular order.

pop_args
    my $value = $obj->pop_args;

Pops the last element off the array, returning it.

push_args
    $obj->push_args(@values);

Pushes elements onto the end of the array.

set_args
    $obj->set_args(1 => $x, 5 => $y);

Takes a list of index/value pairs and for each pair it sets the array element at the indicated index to the indicated value. Returns the number of elements that have been set.

shift_args
    my $value = $obj->shift_args;

Shifts the first element off the array, returning it.

splice_args
    $obj->splice_args(2, 1, $x, $y);
    $obj->splice_args(-1);
    $obj->splice_args(0, -1);

Takes three arguments: An offset, a length and a list.

Removes the elements designated by the offset and the length from the array, and replaces them with the elements of the list, if any. In list context, returns the elements removed from the array. In scalar context, returns the last element removed, or undef if no elements are removed. The array grows or shrinks as necessary. If the offset is negative then it starts that far from the end of the array. If the length is omitted, removes everything from the offset onward. If the length is negative, removes the elements from the offset onward except for -length elements at the end of the array. If both the offset and the length are omitted, removes everything. If the offset is past the end of the array, it issues a warning, and splices at the end of the array.

unshift_args
    $obj->unshift_args(@values);

Unshifts elements onto the beginning of the array.

values_opt
    my @values = $obj->values_opt;

Returns a list of all hash values in no particular order.

Dist::Joseki::Cmd::Command inherits from App::Cmd::Command and Dist::Joseki::Base.

The superclass App::Cmd::Command defines these methods and functions:

    new(), _option_processing_params(), _usage_text(), abstract(), app(),
    command_names(), prepare(), usage(), usage_desc(), usage_error()

The superclass App::Cmd::ArgProcessor defines these methods and functions:

    _process_args()

The superclass Dist::Joseki::Base defines these methods and functions:

    assert_is_dist_base_dir(), print_header(), read_from_cmd(),
    safe_system()

The superclass Class::Accessor::Complex defines these methods and functions:

    mk_abstract_accessors(), mk_array_accessors(), mk_boolean_accessors(),
    mk_class_array_accessors(), mk_class_hash_accessors(),
    mk_class_scalar_accessors(), mk_concat_accessors(),
    mk_forward_accessors(), mk_hash_accessors(), mk_integer_accessors(),
    mk_new(), mk_object_accessors(), mk_scalar_accessors(),
    mk_set_accessors(), mk_singleton()

The superclass Class::Accessor defines these methods and functions:

    _carp(), _croak(), _mk_accessors(), accessor_name_for(),
    best_practice_accessor_name_for(), best_practice_mutator_name_for(),
    follow_best_practice(), get(), make_accessor(), make_ro_accessor(),
    make_wo_accessor(), mk_accessors(), mk_ro_accessors(),
    mk_wo_accessors(), mutator_name_for(), set()

The superclass Class::Accessor::Installer defines these methods and functions:

    install_accessor()

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org.

INSTALLATION ^

See perlmodinstall for information and options on installing Perl modules.

AVAILABILITY ^

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you. Or see http://search.cpan.org/dist/Dist-Joseki/.

AUTHORS ^

Marcel Grünauer, <marcel@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2007-2009 by the authors.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: