Prevent "uninitialized value" warnings in parameter logging collab/berick/param-log-warning-cleanup
authorBill Erickson <berick@esilibrary.com>
Tue, 26 Jun 2012 13:21:57 +0000 (09:21 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 26 Jun 2012 13:21:57 +0000 (09:21 -0400)
Use of uninitialized value $p[0] in join or string at
/usr/local/share/perl/5.10.1/OpenSRF/Application.pm line 130.

This is caused when the array of method params contains null/undef
values.  Prevent the warnings by replacing these values w/ empty
strings.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/perl/lib/OpenSRF/Application.pm

index 6ebfe4b..10ead2f 100644 (file)
@@ -127,7 +127,8 @@ sub handler {
         my @p = $app_msg->params;
                my $method_name = $app_msg->method;
                my $method_proto = $session->last_message_api_level;
-               $log->info("CALL: ".$session->service." $method_name ". (@p ? join(', ',@p) : ''));
+               my $ps = @p ? join(', ', map { (defined $_) ? $_ : '' } @p) : '';
+               $log->info("CALL: ".$session->service." $method_name $ps");
 
                my $coderef = $app->method_lookup( $method_name, $method_proto, 1, 1 );