[interchange] Prevent bug when using scalar as ARRAY ref

Josh Lavin interchange-cvs at icdevgroup.org
Fri Jan 5 16:36:25 UTC 2018


commit 7982277a9e6e3be55d0510a2e61184b5d5b30f14
Author: Josh Lavin <digory at cpan.org>
Date:   Fri Jan 5 08:34:25 2018 -0800

    Prevent bug when using scalar as ARRAY ref
    
    - resulting in error: (Can't use string ("snip") as an ARRAY ref while
      "strict refs" in use at interchange/lib/Vend/Scan.pm line 353.
    )

 lib/Vend/Scan.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/Scan.pm b/lib/Vend/Scan.pm
index e5a4aca..9b5aded 100644
--- a/lib/Vend/Scan.pm
+++ b/lib/Vend/Scan.pm
@@ -345,7 +345,7 @@ sub parse_map {
 	my(@param) = grep $_, split /[\r\n]+/, $params;
 	for(@param) {
 		($var,$source) = split /[\s=]+/, $_, 2;
-		$ref->{$var} = [] unless defined $ref->{$var};
+		$ref->{$var} = [] unless $ref->{$var} and ref $ref->{$var} eq 'ARRAY';
 		$ref->{$source} = '' if ! defined $ref->{$source};
 		$ref->{$source} =~ s/\0/|/g;
 		push @{$ref->{$var}}, ($ref->{$source});



More information about the interchange-cvs mailing list