services: services/perl/lib/AppSwitch/Base Client.pm
Status: Pre-Alpha
Brought to you by:
jgsmith
From: <app...@li...> - 2001-07-27 23:26:29
|
jgsmith 01/07/27 16:26:28 Modified: perl/lib/AppSwitch/Base Client.pm Log: Allow functional use of client interfaces Revision Changes Path 1.2 +19 -2 services/perl/lib/AppSwitch/Base/Client.pm Index: Client.pm =================================================================== RCS file: /cvsroot/appswitch/services/perl/lib/AppSwitch/Base/Client.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -b -u -r1.1 -r1.2 --- Client.pm 2001/07/20 20:54:09 1.1 +++ Client.pm 2001/07/27 23:26:28 1.2 @@ -5,7 +5,7 @@ use Carp; use SOAP::Transport::UNIX; -# $ Id: $ +# $Id: Client.pm,v 1.2 2001/07/27 23:26:28 jgsmith Exp $ =head1 NAME @@ -146,8 +146,25 @@ } } +=item object_or_default +This will return all the arguments with the first argument guarenteed to be +a valid client object. +=cut + + + +sub object_or_default { + return @_ if ref $_[0] && $_[0] -> isa(AppSwitch::Base::Client); + my $caller = caller; + our $_clients; + $_clients{$caller} = $caller -> new() unless defined $_clients{$caller}; + return ($_clients{$caller}, @_); +} + + + =item version This will return the version of the service provider. If @@ -159,7 +176,7 @@ sub version { - my($self) = shift; + my($self) = object_or_default(@_); return $self -> request("version"); } |