File: listMethods.code

package info (click to toggle)
librpc-xml-perl 0.82-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,352 kB
  • sloc: perl: 9,665; xml: 3,020; makefile: 17
file content (34 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
###############################################################################
#
#   Sub Name:       listMethods
#
#   Description:    Read the current list of methods from the server object
#                   and return the names in a list reference.
#
#   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
#                   $srv      in      ref       Server object instance
#                   $pat      in      scalar    If passed, a substring to match
#                                                 names against. NOT a regex!
#
#   Globals:        None.
#
#   Environment:    None.
#
#   Returns:        listref
#
###############################################################################
sub listMethods
{
    use strict;

    my $srv = shift;
    my $pat = shift;

    my @list = sort $srv->list_methods;

    # Exclude any that are hidden from introspection APIs
    @list = grep(! $srv->get_method($_)->hidden, @list);
    @list = grep(index($_, $pat) != -1, @list) if ($pat);

    \@list;
}