[MOBY-guts] biomoby commit

Frank Gibbons fgibbons at pub.open-bio.org
Fri Sep 16 17:01:11 UTC 2005


fgibbons
Fri Sep 16 13:01:11 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv23895/MOBY/Client

Modified Files:
	Central.pm 
Log Message:
 - Clean up some regular expressions, make easier to read.
 - ref operator returns scalar (string), so we should use string comparison.
 - Remove redundant "Title" in docs. That's what =head2 is for.
 - Clean up setting default values using short-circuiting || operator.

moby-live/Perl/MOBY/Client Central.pm,1.123,1.124
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2005/08/31 22:32:27	1.123
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2005/09/16 17:01:10	1.124
@@ -55,6 +55,9 @@
 be sufficient for most or all MOBY Client activities written in Perl.
 
 
+=cut
+
+
 =head1 AUTHORS
 
 Mark Wilkinson (markw at illuminae.com)
@@ -70,7 +73,6 @@
 
 =head2 new
 
- Title     :	new
  Usage     :	my $MOBY = MOBY::Client::Central->new(Registries => \%regrefs)
  Function  :	connect to one or more MOBY-Central
                 registries for searching
@@ -140,8 +142,7 @@
 	  (
 		Connections             => [ undef,         'read/write' ],
 		default_MOBY_servername => [ 'mobycentral', 'read/write' ],
-		default_MOBY_server     => [
-			
+		default_MOBY_server     => [			
 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl',
 			'read/write'
 		],
@@ -239,119 +240,119 @@
 }
 
 sub new {
-	my ( $caller, %args ) = @_;
-	my $caller_is_obj = ref($caller);
-	return $caller if $caller_is_obj;
-	my $class = $caller_is_obj || $caller;
-	my $proxy;
-	my $self = bless {}, $class;
-	foreach my $attrname ( $self->_standard_keys ) {
-		if ( exists $args{$attrname} ) {
-			$self->{$attrname} = $args{$attrname};
-		}
-		elsif ($caller_is_obj) {
-			$self->{$attrname} = $caller->{$attrname};
-		}
-		else {
-			$self->{$attrname} = $self->_default_for($attrname);
-		}
-	}
-	$self->Connections( [] );    # initialize;
-
-	# if user has set up preferred servers, then use those by default
-	$self->default_MOBY_server( $ENV{MOBY_SERVER} ) if $ENV{MOBY_SERVER};
-	$self->default_MOBY_uri( $ENV{MOBY_URI} )       if $ENV{MOBY_URI};
-	$self->default_MOBY_type( $ENV{MOBY_TYPE} )     if $ENV{MOBY_TYPE};
-	$self->default_MOBY_proxy( $ENV{MOBY_PROXY} )   if $ENV{MOBY_PROXY};
-	if ( $self->Registries ) {
-		my $regno = 0;
-		my %reg   = %{ $self->Registries };
-		while ( my ( $name, $acc ) = each %reg ) {
-			$regno++;            # count how many registries we have in total
-			my $url  = $acc->{URL}  ? $acc->{URL}  : $self->default_MOBY_server;
-			my $uri  = $acc->{URI}  ? $acc->{URI}  : $self->default_MOBY_uri;
-			my $type = $acc->{TYPE} ? $acc->{TYPE} : $self->default_MOBY_type;
-			my $proxy =
-			  $acc->{PROXY} ? $acc->{PROXY} : $self->default_MOBY_proxy;
-			$type ||= 'soap';
-			if ( lc($type) eq "get" ) {
-				push @{ $self->Connections }, [ $name, $type, $url ];
-			}
-			else {
-				my @soapargs;
-				if ($proxy) {
-					@soapargs = ( $url, proxy => [ 'http' => $proxy ] );
-				}
-				else {
-					@soapargs = ($url);
-				}
-				push @{ $self->Connections }, [
-					$name, $type,
-					SOAP::Lite->proxy(@soapargs)->uri($uri)->on_fault(
-						sub {
-							my ( $soap, $res ) = @_;
-							die ref $res
-							  ? $res->faultstring
-							  : $soap->transport->status,
-							  "\n ERROR ERROR ERROR\n";
-						}
-					)
-				];
-			}
-		}
-		$self->multiple_registries( $regno - 1 )
-		  ; # one is not "multiple", it is just a change in default -> set to "false" if only one
+  my ( $caller, %args ) = @_;
+  my $caller_is_obj = ref($caller);
+  return $caller if $caller_is_obj;
+  my $class = $caller_is_obj || $caller;
+  my $proxy;
+  my $self = bless {}, $class;
+  foreach my $attrname ( $self->_standard_keys ) {
+    if ( exists $args{$attrname} ) {
+      $self->{$attrname} = $args{$attrname};
+    }
+    elsif ($caller_is_obj) {
+      $self->{$attrname} = $caller->{$attrname};
+    }
+    else {
+      $self->{$attrname} = $self->_default_for($attrname);
+    }
+  }
+  $self->Connections( [] );    # initialize;
+  
+  # if user has set up preferred servers, then use those by default
+  $self->default_MOBY_server( $ENV{MOBY_SERVER} ) if $ENV{MOBY_SERVER};
+  $self->default_MOBY_uri( $ENV{MOBY_URI} )       if $ENV{MOBY_URI};
+  $self->default_MOBY_type( $ENV{MOBY_TYPE} )     if $ENV{MOBY_TYPE};
+  $self->default_MOBY_proxy( $ENV{MOBY_PROXY} )   if $ENV{MOBY_PROXY};
+  if ( $self->Registries ) {
+    my $regno = 0;
+    my %reg   = %{ $self->Registries };
+    while ( my ( $name, $acc ) = each %reg ) {
+      $regno++;            # count how many registries we have in total
+      my $url  = $acc->{URL}  ? $acc->{URL}  : $self->default_MOBY_server;
+      my $uri  = $acc->{URI}  ? $acc->{URI}  : $self->default_MOBY_uri;
+      my $type = $acc->{TYPE} ? $acc->{TYPE} : $self->default_MOBY_type;
+      my $proxy = $acc->{PROXY} ? $acc->{PROXY} : $self->default_MOBY_proxy;
+      $type ||= 'soap';
+      if ( lc($type) eq "get" ) {
+	push @{ $self->Connections }, [ $name, $type, $url ];
+      }
+      else {
+	my @soapargs;
+	if ($proxy) {
+	  @soapargs = ( $url, proxy => [ 'http' => $proxy ] );
 	}
 	else {
-		$self->multiple_registries(0);
-		if ( lc( $self->default_MOBY_type ) eq "get" ) {
-			push @{ $self->Connections },
-			  [
-				$self->default_MOBY_servername, $self->default_MOBY_type,
-				$self->default_MOBY_server
-			  ];
-		}
-		else {
-			$self->Registries(
-				{
-					$self->default_MOBY_servername => {
-						URL => $self->default_MOBY_server,
-						URI => $self->default_MOBY_uri
-					}
-				}
-			);
-			my @soapargs;
-			if ( $self->default_MOBY_proxy ) {
-				@soapargs = (
-					$self->default_MOBY_server,
-					proxy => [ 'http' => $self->default_MOBY_proxy ]
-				);
-			}
-			else {
-				@soapargs = ( $self->default_MOBY_server );
-			}
-			push @{ $self->Connections }, [
-				$self->default_MOBY_servername,
-				$self->default_MOBY_type,
-				SOAP::Lite->proxy(@soapargs)->uri( $self->default_MOBY_uri )
-				  ->on_fault(
-					sub {
-						my ( $soap, $res ) = @_;
-						die ref $res
-						  ? $res->faultstring
-						  : $soap->transport->status, "\n ERROR ERROR ERROR\n";
-					}
-				  )
-			];
-		}
+	  @soapargs = ($url);
 	}
-	return undef unless $self->Connection();    # gotta have at least one...
-	return $self;
+	push @{ $self->Connections },
+	  [
+	   $name, $type,
+	   SOAP::Lite->proxy(@soapargs)->uri($uri)->on_fault(
+							     sub {
+							       my ( $soap, $res ) = @_;
+							       die ref $res
+								 ? $res->faultstring
+								   : $soap->transport->status,
+								     "\n ERROR ERROR ERROR\n";
+							     }
+							    )
+	  ];
+      }
+    }
+    $self->multiple_registries( $regno - 1 )
+      ; # one is not "multiple", it is just a change in default -> set to "false" if only one
+  }
+  else {
+    $self->multiple_registries(0);
+    if ( lc( $self->default_MOBY_type ) eq "get" ) {
+      push @{ $self->Connections },
+	[
+	 $self->default_MOBY_servername, $self->default_MOBY_type,
+	 $self->default_MOBY_server
+	];
+    }
+    else {
+      $self->Registries(
+			{
+			 $self->default_MOBY_servername => {
+							    URL => $self->default_MOBY_server,
+							    URI => $self->default_MOBY_uri
+							   }
+			}
+		       );
+      my @soapargs;
+      if ( $self->default_MOBY_proxy ) {
+	@soapargs = (
+		     $self->default_MOBY_server,
+		     proxy => [ 'http' => $self->default_MOBY_proxy ]
+		    );
+      }
+      else {
+	@soapargs = ( $self->default_MOBY_server );
+      }
+      push @{ $self->Connections }, 
+	[
+	 $self->default_MOBY_servername,
+	 $self->default_MOBY_type,
+	 SOAP::Lite->proxy(@soapargs)->uri( $self->default_MOBY_uri )
+	 ->on_fault(
+		    sub {
+		      my ( $soap, $res ) = @_;
+		      die ref $res
+			? $res->faultstring
+			  : $soap->transport->status, "\n ERROR ERROR ERROR\n";
+		    }
+		   )
+	];
+    }
+  }
+  return undef unless $self->Connection();    # gotta have at least one...
+  return $self;
 }
 
 =head2 registerObject  a.k.a registerObjectClass
 
- Title     :	registerObject ; registerObjectClass
  Usage     :	$REG = $MOBY->registerObject(%args)
  Usage     :	$REG = $MOBY->registerObjectClass(%args)
  Function  :	register a new type of MOBY Object
@@ -383,18 +384,13 @@
 "Contact email address (contactEmail parameter) is required for object registration"
 	  )
 	  if ( !$a{contactEmail} );
-	my $term = $a{'objectType'};
-	$term ||= "";
-	my $desc = $a{'description'};
-	$desc ||= "";
+	my $term = $a{'objectType'} || "";
+	my $desc = $a{'description'} || "";
 	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
-	my $contactEmail = $a{'contactEmail'};
-	$contactEmail ||= "";
-	my $authURI = $a{'authURI'};
-	$authURI ||= "";
-	$authURI ||= "";
+	my $contactEmail = $a{'contactEmail'} || "";
+	my $authURI = $a{'authURI'} || "";
 	my %Relationships = %{ $a{'Relationships'} };
 	my $clobber       = $a{'Clobber'} ? $a{'Clobber'} : 0;
 	my $message       = "<registerObjectClass>
@@ -427,7 +423,6 @@
 
 =head2 deregisterObject a.k.a. deregisterObjectClass
 
- Title     :	deregisterObject ; deregisterObjectClass
  Usage     :	$REG = $MOBY->deregisterObject(%args)
  Usage     :	$REG = $MOBY->deregisterObjectClass(%args)
  Function  :	deregister a MOBY Object
@@ -447,8 +442,7 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $id = $a{'objectType'};
-	$id ||= "";
+	my $id = $a{'objectType'} || "";
 	my $message = "
 		<deregisterObjectClass>
 			<objectType>$id</objectType>
@@ -461,7 +455,6 @@
 
 =head2 retrieveObjectDefinition
 
- Title     : retrieveObjectDefinition
  Usage     : $DEF = $MOBY->retrieveObjectDefinition($objectType[,$registry])
  Function  : retrieve the $XML that was used to register an object and its relationships
  Returns   : hashref, identical to the hash sent during Object registration, plus
@@ -567,7 +560,6 @@
 
 =head2 registerServiceType
 
- Title     :	registerServiceType
  Usage     :	$REG = $MOBY->registerServiceType(%args)
  Function  :	register a new MOBY Service type
  Returns   :	MOBY::Registration object
@@ -585,17 +577,14 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $type = $a{'serviceType'};
-	$type ||= "";
+	my $type = $a{'serviceType'} || "";
 	my $desc = $a{'description'};
 	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	$desc ||= "";
-	my $email = $a{'contactEmail'};
-	$email ||= "";
-	my $auth = $a{'authURI'};
-	$auth ||= "";
+	my $email = $a{'contactEmail'} || "";
+	my $auth = $a{'authURI'} || "";
 	my %Relationships = %{ $a{'Relationships'} };
 	my $message       = "
 		<registerServiceType>
@@ -620,7 +609,6 @@
 
 =head2 deregisterServiceType
 
- Title     :	deregisterServiceType
  Usage     :	$REG = $MOBY->deregisterServiceType(%args)
  Function  :	deregister a deprecated MOBY Service Type
  Returns   :	MOBY::Registration object
@@ -634,8 +622,7 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $id = $a{'serviceType'};
-	$id ||= "";
+	my $id = $a{'serviceType'} || "";
 	my $message = "
 		<deregisterServiceType>
 			<serviceType>$id</serviceType>
@@ -648,7 +635,6 @@
 
 =head2 registerNamespace
 
- Title     :	registerNamespace
  Usage     :	$REG = $MOBY->registerNamespace(%args)
  Function  :	register a new Namespace
  Returns   :	MOBY::Registration object
@@ -665,17 +651,14 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $type = $a{'namespaceType'};
-	$type ||= "";
-	my $authURI = $a{'authURI'};
-	$authURI ||= "";
+	my $type = $a{'namespaceType'} || "";
+	my $authURI = $a{'authURI'} || "";
 	my $desc = $a{'description'};
 	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	$desc ||= "";
-	my $contact = $a{'contactEmail'};
-	$contact ||= "";
+	my $contact = $a{'contactEmail'} || "";
 	my $message = "
 		<registerNamespace>
 			<namespaceType>$type</namespaceType>
@@ -691,7 +674,6 @@
 
 =head2 deregisterNamespace
 
- Title     :	deregisterNamespace
  Usage     :	$REG = $MOBY->deregisterNamespace(%args)
  Function  :	deregister a deprecated MOBY Namespace
  Returns   :	MOBY::Registration object
@@ -705,8 +687,7 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $id = $a{'namespaceType'};
-	$id ||= "";
+	my $id = $a{'namespaceType'} || "";
 	my $message = "
 		<deregisterNamespace>
 			<namespaceType>$id</namespaceType>
@@ -719,7 +700,6 @@
 
 =head2 registerService
 
- Title     :	registerService
  Usage     :	$REG = $MOBY->registerService(%args)
  Function  :	register a new MOBY Service instance
  Returns   :	MOBY::Registration object
@@ -774,24 +754,17 @@
 	return $self->errorRegXML(
 		"Function not allowed when querying multiple registries")
 	  if $self->multiple_registries;
-	my $name = $a{serviceName};
-	$name ||= "";
-	my $type = $a{serviceType};
-	$type ||= "";
-	my $authURI = $a{authURI};
-	$authURI ||= "";
-	my $email = $a{contactEmail};
-	$email ||= "";
-	my $URL = $a{URL};
-	$URL ||= "";
-	my $desc = $a{description};
-	$desc ||= "";
+	my $name = $a{serviceName} || "";
+	my $type = $a{serviceType} || "";
+	my $authURI = $a{authURI} || "";
+	my $email = $a{contactEmail} || "";
+	my $URL = $a{URL} || "";
+	my $desc = $a{description} || "";
 
 	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
-	my $signatureURL = $a{signatureURL};
-	$signatureURL ||= "";
+	my $signatureURL = $a{signatureURL} || "";
 	my $Category = lc( $a{category} );
 	chomp $Category;
 	$Category ||= "";
@@ -856,10 +829,10 @@
 
 	if ( $Category eq "moby" || $Category eq 'soap' ) {
 		my %SEC;
-		if ( $a{'secondary'} && ( ref( $a{'secondary'} ) =~ /hash/i ) ) {
+		if ( $a{'secondary'} && ( ref( $a{'secondary'} ) eq 'HASH' ) ) {
 			%SEC = %{ $a{secondary} };
 		}
-		elsif ( $a{'secondary'} && !( ref( $a{'secondary'} ) =~ /hash/i ) ) {
+		elsif ( $a{'secondary'} && ( ref( $a{'secondary'} ) ne 'HASH' ) ) {
 			return $self->errorRegXML(
 				"invalid structure of secondary parameters.  Expected hashref."
 			);
@@ -880,11 +853,11 @@
 				my ( $articleName, $def ) = @{$article};
 				$articleName ||= "";
 				my @Objects;    #
-				unless ( (ref($def) =~ /array/i)) { # $def = [objType => \@ns]  or $def=[[objType => \@ns]]
+				unless ( ref($def) eq 'ARRAY') { # $def = [objType => \@ns]  or $def=[[objType => \@ns]]
 					return $self->errorRegXML("invalid structure of $inout objects, expected SINGLE arrayref for article $articleName as required by the 0.86 API");
 				}
 				my @objectdefs;
-				if ( ( ref $def->[0] ) =~ /array/i ) {    # collection $def->[0] = [objType => \@ns]
+				if ( ( ref $def->[0] ) eq 'ARRAY' ) {    # collection $def->[0] = [objType => \@ns]
 					    # def= [[objType2 => [ns3, ns4...]], ...]
 					$message .= "<Collection articleName='$articleName'>\n";
 					if (scalar(@{$def->[0]} > 2)){
@@ -899,7 +872,7 @@
 				  @objectdefs = ($def);
 				}
 				foreach my $objectdef (@objectdefs) {
-					if ( ( ref( $def->[0] ) ) =~ /array/i ) {
+					if ( ref( $def->[0] ) eq 'ARRAY' ) {
 						$message .= "<Simple>\n";
 					}
 					else {
@@ -908,7 +881,7 @@
 					my ( $type, $Namespaces ) = @{$objectdef};
 					$type ||= "";
 					$message .= "<objectType>$type</objectType>\n";
-					unless ( ref($Namespaces) =~ /array/i ) {
+					unless ( ref($Namespaces) eq 'ARRAY' ) {
 						return $self->errorRegXML(
 "invalid structure of $inout namespaces for object $type in article $articleName; expected arrayref"
 						);
@@ -918,7 +891,7 @@
 					}
 					$message .= "</Simple>\n";
 				}
-				if ( ( ref( $def->[0] ) ) =~ /array/i ) {
+				if ( ref( $def->[0] ) eq  'ARRAY' ) {
 					$message .= "</Collection>\n";
 				}
 			}
@@ -939,7 +912,7 @@
 		#
 		$message .= "<secondaryArticles>\n";
 		while ( my ( $param, $desc ) = each %SEC ) {
-			unless ( ( ref($desc) ) =~ /hash/i ) {
+			unless ( ref($desc) eq 'HASH' ) {
 				return $self->errorRegXML( "invalid structure of secondary article $param; expected hashref of limitations"
 				);
 			}
@@ -953,15 +926,12 @@
 				return $self->errorRegXML("a secondaryArticle must contain at least a datatype value in secondary article $param"
 				);
 			}
-			unless ( ( $datatype =~ /Integer/ )
-				|| ( $datatype =~ /Float/ )
-				|| ( $datatype =~ /String/ )
-				|| ( $datatype =~ /DateTime/ ) )
+			unless ( $datatype =~ /Integer|Float|String|DateTime/ )
 			{
 				return $self->errorRegXML("a secondaryArticle must have a datatype of Integer, Float, String, or DateTime"
 				);
 			}
-			unless ( ( ref($enums) ) =~ /array/i ) {
+			unless ( ref($enums) eq 'ARRAY' ) {
 				return $self->errorRegXML("invalid structure of enum limits in secondary article $param; expected arrayref"
 				);
 			}
@@ -1029,9 +999,7 @@
 
 =head2 registerServiceWSDL
 
- Title     :	registerServiceWSDL
- Usage     :	not yet implemented
-
+ Usage     :	Needs documentation
 
 =cut
 
@@ -1050,7 +1018,6 @@
 
 =head2 deregisterService
 
- Title     :	deregisterService
  Usage     :	$REG = $MOBY->deregisterService(%args)
  Function  :	deregister a registered MOBY Service
  Returns   :	MOBY::Registration object
@@ -1087,7 +1054,6 @@
 
 =head2  findService
 
- Title     :	findService
  Usage     :	($ServiceInstances, $RegObject) = $MOBY->findService(%args)
  Function  :	Find services that match certain search criterion
  Returns   :	ON SUCCESS: arrayref of MOBY::Client::ServiceInstance objects, and undef
@@ -1123,23 +1089,15 @@
 	my ( $self, %a ) = @_;
 	my $reg = ( $a{Registry} ) ? $a{Registry} : $self->default_MOBY_servername;
 	my $id = $a{'serviceID'};
-	my $servicename = $a{'serviceName'};
-	$servicename ||= "";
-	my $authoritative = $a{'authoritative'};
-	$authoritative ||= 0;
-	my $serviceType = $a{'serviceType'};
-	$serviceType ||= "";
-	my $authURI = $a{'authURI'};
-	$authURI ||= "";
-	my $category = $a{'category'};
-	$category ||= "moby";
-	my $exObj = $a{'expandObjects'};
-	$exObj ||= 0;
-	my $exServ = $a{'expandServices'};
-	$exServ ||= 0;
-	my $kw = $a{'keywords'};
-	$kw ||= [];
-	ref($kw) =~ /array/i || return (
+	my $servicename = $a{'serviceName'} || "";
+	my $authoritative = $a{'authoritative'} || 0;
+	my $serviceType = $a{'serviceType'} || "";
+	my $authURI = $a{'authURI'} || "";
+	my $category = $a{'category'} || "moby";
+	my $exObj = $a{'expandObjects'} || 0;
+	my $exServ = $a{'expandServices'} || 0;
+	my $kw = $a{'keywords'} || [];
+	ref($kw) eq 'ARRAY' || return (
 		undef,
 		$self->errorRegXML(
 			"invalid structure of keywords.  Expected arrayref"
@@ -1168,7 +1126,7 @@
 
 	#$a{input} = [[]] unless (defined $a{input});
 	#$a{output} = [[]] unless (defined $a{output});
-	if ( defined $a{input} && !( ref( $a{input} ) =~ /array/i ) ) {
+	if ( defined $a{input} && ( ref( $a{input} ) ne 'ARRAY' ) ) {
 		return (
 			undef,
 			$self->errorRegXML(
@@ -1176,7 +1134,7 @@
 			)
 		);
 	}
-	if ( defined $a{output} && !( ref( $a{output} ) =~ /array/i ) ) {
+	if ( defined $a{output} && ( ref( $a{output} ) ne 'ARRAY' ) ) {
 		return (
 			undef,
 			$self->errorRegXML(
@@ -1198,12 +1156,12 @@
 		die "no inout parameter from teh funkyhash" unless defined $inout;
 		die "no param parameter from teh funkyhash" unless defined $param;
 		die "param parameter should be a listref"
-		  unless ( ref($param) =~ /ARRAY/ );
+		  unless ( ref($param) eq 'ARRAY' );
 		my $inout_lc = lc($inout);
 		my @PARAM    = @{$param};
 		$message .= "<${inout_lc}Objects><${inout}>\n";
 		foreach my $param (@PARAM) {
-			unless ( ref($param) =~ /array/i ) {
+			unless ( ref($param) eq 'ARRAY' ) {
 				return (
 					undef,
 					$self->errorRegXML(
@@ -1216,7 +1174,7 @@
 
 			#warn "no namespace part of the param" unless defined $namespaces;
 			my @objectdefs;
-			if ( ( ref $class ) =~ /array/i ) {    # collection
+			if ( ref $class  eq 'ARRAY' ) {    # collection
 				$message .= "<Collection>\n";
 				@objectdefs = $class;
 			}
@@ -1229,7 +1187,7 @@
 				die "type is missing from objectdef " unless $type;
 				$message .= "<objectType>$type</objectType>\n";
 				if ( defined($Namespaces)
-					&& !( ref($Namespaces) =~ /array/i ) )
+					&& ( ref($Namespaces) ne 'ARRAY' ) )
 				{
 					return (
 						undef,
@@ -1244,7 +1202,7 @@
 				}
 				$message .= "</Simple>\n";
 			}
-			if ( ( ref($class) ) =~ /array/i ) {
+			if ( ref($class) eq 'ARRAY' ) {
 				$message .= "</Collection>\n";
 			}
 		}
@@ -1259,7 +1217,6 @@
 
 =head2 retrieveService
  
- Title     :	retrieveService  
  Usage     :	$WSDL = $MOBY->retrieveService($ServiceInstance)
  Function  :	get the WSDL definition of the service with this name/authority URI
  Returns   :	a WSDL string
@@ -1304,7 +1261,6 @@
 
 =head2 retrieveResourceURLs
 
- Title     :	retrieveResourceURLs()
  Usage     :	$names = $MOBY->retrieveResourceURLs()
  Function  :	get a hash of the URL's for each of the MOBY ontologies
  Returns   :	hashref to the following hash
@@ -1336,7 +1292,6 @@
 
 =head2 retrieveServiceNames
 
- Title     :	retrieveServiceNames(%args)
  Usage     :	$names = $MOBY->retrieveServiceNames([$reg_name])
  Function  :	get a (redundant) list of all registered service names
                 (N.B. NOT service types!)
@@ -1382,7 +1337,6 @@
 
 =head2 retrieveServiceProviders
 
- Title     :	retrieveServiceProviders
  Usage     :	@URIs = $MOBY->retrieveServiceProviders([$reg_name])
  Function  :	get the list of all provider's AuthURI's
  Returns   :	list of service provider URI strings
@@ -1413,7 +1367,6 @@
 
 =head2 retrieveServiceTypes
 
- Title     :	retrieveServiceTypes(%args)
  Usage     :	$types = $MOBY->retrieveServiceTypes([$reg_name])
  Function  :	get the list of all registered service types
  Returns   :	hashref of $types{$type} = $definition
@@ -1463,7 +1416,6 @@
 
 =head2 retrieveObjectNames
 
- Title     :	retrieveObjectNames(%args)
  Usage     :	$names = $MOBY->retrieveObjectNames([$reg_name])
  Function  :	get the list of all registered Object types
  Returns   :	hashref of hash:
@@ -1511,7 +1463,6 @@
 
 =head2 retrieveNamespaces
 
- Title     :	retrieveNamespaces(%args)
  Usage     :	$ns = $MOBY->retrieveNamespaces([$reg_name])
  Function  :	get the list of all registered Namespace types
  Returns   :	hashref of hash:
@@ -1562,7 +1513,6 @@
 
 =head2 retrieveObject
 
- Title     :	retrieveObject
  Usage     :	$objects = $MOBY->retrieveObjectNames(%args)
  Function  :	get the object xsd
  Returns   :	hashref of hash:
@@ -1616,7 +1566,6 @@
 
 =head2 Relationships
 
- Title     :    Relationships
  Usage     :	$def = $MOBY->Relationships(%args)
  Function  :	traverse and return the relationships in the ontology
  Returns   :    hashref of   $hash{relationship_type}=\@lsids
@@ -1639,7 +1588,7 @@
 	my @relationships;
 	@relationships = @{ $args{'Relationships'} }
 	  if ( $args{'Relationships'}
-		&& ( ref( $args{'Relationships'} ) =~ /array/i ) );
+		&& ( ref( $args{'Relationships'} ) eq 'ARRAY' ) );
 	push @relationships, 'isa' unless $relationships[0];  # need to have at least one relationship
 	my $reg = $args{'Registry'};
 	my $m;
@@ -1714,7 +1663,6 @@
 
 =head2 ISA
 
- Title     :    ISA
  Usage     :	$def = $MOBY->ISA($class1, $class2)
  Function  :	a pre-canned use of the Relationships function
                 to quickly get an answer to whether class1 ISA class2
@@ -1760,8 +1708,6 @@
 
 =head2 DUMP
 
-
- Title     :	DUMP
  Usage     :	($mobycentral, $mobyobject, $mobyservice, $mobynamespace, $mobyrelationship) = $MOBY->DUMP(['registry'])
  Function  :	DUMP the mysql for the current MOBY Central database
  Returns   :	text
@@ -1919,7 +1865,6 @@
 
 =head2 LSID_CACHE
 
- Title     :	LSID_CACHE
  Usage     :	$lsid = $MOBY->LSID_CACHE($term, $lsid)
  Function  :	get/set LSID from the cache
  Returns   :	lsid as a scalar
@@ -1944,7 +1889,6 @@
 
 =head2 ISA_CACHE
 
- Title     : ISA_CACHE
  Usage     : @lsids = $MOBY->ISA_CACHE($lsid, \@isas)
  Function  : get/set the ISA relationships in the cache
  Returns   : list of ISA relationships.  The ISA list
@@ -1959,7 +1903,7 @@
 sub ISA_CACHE {
 	my ( $self, $desiredterm, $isas ) = @_;
 	my $term = $desiredterm;
-	return (undef) if $isas && !( ref($isas) =~ /ARRAY/ );
+	return (undef) if $isas && ( ref($isas) ne 'ARRAY');
 	if ( $term && $isas ) {
 		my @isalsids;
 		foreach (@$isas){




More information about the MOBY-guts mailing list