[system] / trunk / xmlrpc / RPC / RPC-XML-0.25 / methods / methodHelp.code Repository:
ViewVC logotype

View of /trunk/xmlrpc/RPC/RPC-XML-0.25/methods/methodHelp.code

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (download) (annotate)
Fri May 17 21:44:04 2002 UTC (17 years ago) by gage
File size: 1294 byte(s)
Experimental xmlrpc WeBWorK webservices

    1 ###############################################################################
    2 #
    3 #   Sub Name:       methodHelp
    4 #
    5 #   Description:    Retrieve any help text for the specified methods.
    6 #
    7 #   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
    8 #                   $srv      in      ref       Server object instance
    9 #                   $arg      in      ref/sc    Listref or scalar specification
   10 #
   11 #   Globals:        None.
   12 #
   13 #   Environment:    None.
   14 #
   15 #   Returns:        Success:    string or listref
   16 #                   Failure:    fault object
   17 #
   18 ###############################################################################
   19 sub methodHelp
   20 {
   21     use strict;
   22 
   23     my $srv = shift;
   24     my $arg = shift;
   25 
   26     my $name = $srv->{method_name};
   27     my $scalar = (ref $arg) ? 0 : 1;
   28     my @list = ($scalar) ? ($arg) : @$arg;
   29     my @results = ();
   30 
   31     # Exclude any that are hidden from introspection APIs
   32     @list = grep(! $srv->{__method_table}->{$_}->{hidden}, @list);
   33     for (@list)
   34     {
   35         if ($srv->{__method_table}->{$_})
   36         {
   37             push(@results, $srv->{__method_table}->{$_}->{help} || '');
   38         }
   39         else
   40         {
   41             return RPC::XML::fault->new(302, "$name: Method $_ unknown");
   42         }
   43     }
   44 
   45     return ($scalar) ? $results[0] : \@results;
   46 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9