Victor > Grid-Request > Grid::Request::Param

Download:
Grid-Request-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.11   Source  

NAME ^

Param.pm - Models a parameter for Grid::Request jobs.

VERSION ^

This document refers to Param.pm

SYNOPSIS ^

 use Grid::Request::Param;
 my $param = Grid::Request:Param->new();
 $param->type("DIR");
 $param->key('--file=$(Name)');
 $param->value("/path/to/some/directory");

DESCRIPTION ^

A module that models Grid::Request parameters.

$obj->type([$type]);

Description: Sets or retrieves the type of the parameter. Allowable "types" are: ARRAY, DIR, FILE, and the default, PARAM.

Parameters: An optional scalar, $type.

Returns: If called as a getter (no-arguments), returns the current type. If called as a setter, nothing is returned (undef).

$obj->value([$value]);

Description: A getter/setter that is used to set and retrieve the "value" of a Grid::Request parameter. Grid::Request jobs may specified an executable to run on the grid, and the executable may have or require one or more arguments (such as those typically specified on the command line). These arguments are modeled with the Grid::Request::Param module. Simple parameters do not trigger any iteration, however, parameters of type "ARRAY", "DIR", and "FILE", trigger iterations, and subsequently grid jobs that perform "parameter sweep" (sometimes referred to as "array jobs").

Parameters: None.

Returns: If called as a getter (no-arguments), returns the current value of the parameter. If called as a setter, nothing is returned (undef).

$obj->key([$key]);

Description: For each parameter, the key is what tells how the parameter should be passed as a command line argument and how the values from the iterable directory, array or file are to be dropped into the argument. Parameter keys can make use of two tokens: $(Index) and $(Name). The $(Index) token is replaced at with the actual sequence number of the job on the grid, and the $(Name) token is replaced with the string taken from the iterable value. In the case of parameters of type

    FILE  -> $(Name) is replaced with the string from the line in the file
    ARRAY -> $(Name) is replaced with the value of the element of the array
    DIR   -> $(Name) is replaced with the name of the file in the directory 

Examples:

   FILE
    # From the constructor
    Grid::Request::Param->new( type => "FILE",
                               key  => '--string=$(Name)',
                               value => "/path/to/some/file.txt" )

   DIR
      $param = Grid::Request::Param->new();
      $param->type("DIR");
      $param->key('--filepath=$(Name)');
      $param->value("/path/to/some/directory");

   ARRAY
      $param = Grid::Request::Param->new();
      $param->type("ARRAY");
      $param->key('--element=$(Name)');
      $param->value(\@array);

Parameters: None.

Returns: A non-negative integer scalar.

$obj->count();

Description: Retrieves the number of iterations that this parameter will trigger. For parameters of type "ARRAY", it will be the nubmer of array elements, for parameters of type "DIR", it will be the number of non-hidden files in the specified directory; for parameters of type "FILE", it will the number of lines in the file (with the exception of lines with nothing but whitespace).

Parameters: None.

Returns: A non-negative integer scalar.

ENVIRONMENT ^

This module does not read or set any environment variables.

BUGS ^

None known.

SEE ALSO ^

 Grid::Request
 Grid::Request::Exceptions
 Log::Log4perl
syntax highlighting: