logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Config::Model::Role::ComputeFunction - compute &index or &element functions

Author

       Dominique Dumont

Description

       Role used to let a value object get the index or the element name of $self or of a node above.

Methods

eval_function
       Retrieve the index or the element name. Parameters are

        ( function_name , [ up  ])

       function_name
           "element" or "index"

       up  Optional  parameter  to indicate how many level to go up before retrieving the index or element name.
           Each "-" is equivalent to a call  to  "parent|Config::Model::Node/parent".  Can  be  repeated  dashes
           (""-"", ""- -"", ...)  or a dash with a multiplier (""-"", "-2", ...). White spaces are ignored.

   compute_string
       Perform a similar function as "eval_function" using a string where function names are extracted.

       E.g. "compute_string('&element(-)')" calls "eval_function('element','-')"

Name

       Config::Model::Role::ComputeFunction - compute &index or &element functions

Synopsis

        $value->eval_function('index');
        $value->eval_function('element');

        $value->eval_function('index','-');
        $value->eval_function('index','- -');
        $value->eval_function('index','-3');

        $value->compute_string('&element(-)')
        $value->compute_string('&index(- -)');

Version

       version 2.155

See Also