---
name: "GO::Utils"
section: "3pm"
platform: "linux"
package: "libgo-perl"
version: "0.15-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/GO::Utils"
---

# GO::Utils(3pm)

utilities for GO modules

## NAME

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\_duplicates

remove duplicate items from an array

```
 usage: remove_duplicates(\@arr)
```

affects the array passed in, and returns the modified array

## merge\_hashes

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.

## get\_method\_ref

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

### pset2hash

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

### spell\_greek

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

### check\_obj\_graph

```
  Usage   -
  Returns - true if cycle detected
  Args    - any object
```
