home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / RPC / XML / methodSignature.xpl < prev    next >
Encoding:
Extensible Markup Language  |  2008-11-04  |  2.0 KB  |  72 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE methoddef SYSTEM "rpc-method.dtd">
  3. <!--
  4.     Generated automatically by make_method v1.12, Wed Nov  5 03:59:22 2008
  5.  
  6.     Any changes made here will be lost.
  7. -->
  8. <methoddef>
  9. <name>system.methodSignature</name>
  10. <version>1.2</version>
  11. <signature>array string</signature>
  12. <signature>array array</signature>
  13. <help>
  14. Return the signatures that the specified method(s) may be called with. Always
  15. returns an ARRAY, even if there is only one signature. Either a single method
  16. must be named in the STRING parameter, or a list of one or more may be
  17. specified in the ARRAY parameter. If an ARRAY is passed, then return value will
  18. be an ARRAY containing other ARRAY values, one per requested name.
  19. </help>
  20. <code language="perl">
  21. <![CDATA[
  22. #!/usr/bin/perl
  23. ###############################################################################
  24. #
  25. #   Sub Name:       methodSignature
  26. #
  27. #   Description:    Retrieve the list of method signatures for the specified
  28. #                   methods.
  29. #
  30. #   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
  31. #                   $srv      in      ref       Server object instance
  32. #                   $arg      in      ref/sc    Listref or scalar specification
  33. #
  34. #   Globals:        None.
  35. #
  36. #   Environment:    None.
  37. #
  38. #   Returns:        Success:    listref
  39. #                   Failure:    fault object
  40. #
  41. ###############################################################################
  42. sub methodSignature
  43. {
  44.     use strict;
  45.  
  46.     my $srv = shift;
  47.     my $arg = shift;
  48.  
  49.     my $name = $srv->{method_name};
  50.     my @list = (ref $arg) ? @$arg : ($arg);
  51.     my (@results, $list, $method);
  52.  
  53.     for (@list)
  54.     {
  55.         if (ref($method = $srv->get_method($_)) and (! $method->hidden))
  56.         {
  57.             push(@results,
  58.                  [ map { [ split(/ /) ] } @{$method->signature} ]);
  59.         }
  60.         else
  61.         {
  62.             return RPC::XML::fault->new(302, "$name: Method $_ unknown");
  63.         }
  64.     }
  65.  
  66.     return (ref $arg) ? \@results : $results[0];
  67. }
  68.  
  69. __END__
  70. ]]></code>
  71. </methoddef>
  72.