Loading ...
Sorry, an error occurred while loading the content.

1554Why aren't the routines in SOAP::Server::Parameters methods?

Expand Messages
  • Randy J. Ray
    May 24, 2002
    • 0 Attachment
      The SOAP::Server::Parameters class is very useful for writing server-side
      methods that have a need for access to the SOAP envelope. Perhaps they need to
      check the full package around their data arguments (type, name, URN). Or they
      need access to header data. Whatever the case, it's a very handy feature to

      You use it by having your class/package include SOAP::Server::Parameters in
      the @ISA value, essentially inheriting from it. That means you could include a
      different class that inherits from it, if someone sub-classes it. And it
      provides two utility functions for retrieving values from the envelope by
      parameter name rather than relying on parameter ordering.

      But these two functions (byName and byNameOrOrder) are not methods. They
      expect their first argument to be an array reference of the parameter names
      you wish to retrieve. So they must be called by full package name (since the
      package namespace doesn't export anything), which is kind of a waste because
      the class you are currently in *already inherits from that package*. The
      method object value *could* call these as methods, they exist within the set
      of callable methods. If I have the following:

      package Foo;

      use SOAP::Lite;
      @ISA = qw(SOAP::Server::Parameters);


      sub foo {
      my $self = shift;


      within Foo::foo, "$self->can('byName')" would be true. And:

      @args = $self->byName([qw(...)], @_);

      would be clearer (in my opinion) than:

      @args = SOAP::Server::Parameters::byName([qw(...)], @_);

      ...not to mention considerably easier to type. Plus, it hinders any efforts to
      effectively sub-class SOAP::Server::Parameters.

      Just a thought.

      Randy J. Ray rjray@...
      Campbell, CA rjray@...
      <A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>