File: methodSignature.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 (45 lines) | stat: -rw-r--r-- 1,237 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
35
36
37
38
39
40
41
42
43
44
45
###############################################################################
#
#   Sub Name:       methodSignature
#
#   Description:    Retrieve the list of method signatures for the specified
#                   methods.
#
#   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
#                   $srv      in      ref       Server object instance
#                   $arg      in      ref/sc    Listref or scalar specification
#
#   Globals:        None.
#
#   Environment:    None.
#
#   Returns:        Success:    listref
#                   Failure:    fault object
#
###############################################################################
sub methodSignature
{
    use strict;

    my $srv = shift;
    my $arg = shift;

    my $name = $srv->{method_name};
    my @list = (ref $arg) ? @$arg : ($arg);
    my (@results, $list, $method);

    for (@list)
    {
        if (ref($method = $srv->get_method($_)) and (! $method->hidden))
        {
            push(@results,
                 [ map { [ split(/ /) ] } @{$method->signature} ]);
        }
        else
        {
            return RPC::XML::fault->new(302, "$name: Method $_ unknown");
        }
    }

    return (ref $arg) ? \@results : $results[0];
}