DOKK / manpages / debian 12 / libgo-perl / GO::Utils.3pm.en
GO::Utils(3pm) User Contributed Perl Documentation GO::Utils(3pm)

GO::Utils - utilities for GO modules

rearrange()

 Usage    : n/a
 Function : Rearranges named parameters to requested order.
 Returns  : @params - an array of parameters in the requested order.
 Argument : $order : a reference to an array which describes the desired
                     order of the named parameters.
            @param : an array of parameters, either as a list (in
                     which case the function simply returns the list),
                     or as an associative array (in which case the
                     function sorts the values according to @{$order}
                     and returns that new array.
 Exceptions : carps if a non-recognised parameter is sent

get_param()

Usage : get_param('name',(-att1=>'ben',-name=>'the_name')) Function : Fetches a named parameter. Returns : The value of the requested parameter. Argument : $name : The name of the the parameter desired
@param : an array of parameters, as an associative array Exceptions : carps if a non-recognised parameter is sent

Based on rearrange(), which is originally from CGI.pm by Lincoln Stein and BioPerl by Richard Resnick. See rearrange() for details.

remove duplicate items from an array

 usage: remove_duplicates(\@arr)

affects the array passed in, and returns the modified array

joins two hashes together

 usage: merge_hashes(\%h1, \%h2);

%h1 will now contain the key/val pairs of %h2 as well. if there are key conflicts, %h2 values will take precedence.

 returns a pointer to a particular objects method
 e.g.   my $length_f = get_method_ref($seq, 'length');
        $len = &$length_f();

  Usage   - my $h = pset2hash([{name=>"id", value=>"56"}, {name=>"name", value=>"jim"}]);
  Returns - hashref
  Args    - arrayref of name/value keyed hashrefs

takes a word as a parameter and spells out any greek symbols encoded within (eg s/&agr;/alpha/g)

  Usage   -
  Returns - true if cycle detected
  Args    - any object
2021-01-09 perl v5.32.0