From 4631a4bc4cede3aba04aa2c88a82f0832e2630c6 Mon Sep 17 00:00:00 2001 From: crgeddes Date: Tue, 15 Aug 2017 11:06:49 -0500 Subject: Update perl syntax in new attr gen scripts for perl v5.6.1 Modern version of perl do not allow using hash as a reference. We were sloppy in a few places in the new scripts, this commit updates the syntax to follow latest standards. Change-Id: I43896749b11ebb38e63c668a1c57fa74270c14d8 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/44634 Reviewed-by: William G. Hoffa Tested-by: Jenkins Server Reviewed-by: Prachi Gupta Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: STEWART E. SMITH Reviewed-by: Daniel M. Crowell --- src/usr/targeting/common/xmltohb/handle_duplicate.pl | 6 +++--- .../targeting/common/xmltohb/handle_fapi_attr_mapping.pl | 6 +++--- src/usr/targeting/xmltohb/fapi_utils.pl | 13 ++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) mode change 100755 => 100644 src/usr/targeting/xmltohb/fapi_utils.pl diff --git a/src/usr/targeting/common/xmltohb/handle_duplicate.pl b/src/usr/targeting/common/xmltohb/handle_duplicate.pl index 1a03df31a..e41cea3c2 100755 --- a/src/usr/targeting/common/xmltohb/handle_duplicate.pl +++ b/src/usr/targeting/common/xmltohb/handle_duplicate.pl @@ -112,7 +112,7 @@ foreach my $attribute (@{$allHBAttributes->{attribute}}) { if (exists $attribute->{hwpfToHbAttrMap} ) { - push (@{%hwpfAttributes->{attribute}}, $attribute); + push (@{$hwpfAttributes{attribute}}, $attribute); } } @@ -147,7 +147,7 @@ foreach my $ekbAttr (@{$allEKBAttributes->{attribute}}) } #Loop over HB attrs until we find a match - foreach my $hbAttr (@{%hwpfAttributes->{attribute}}) + foreach my $hbAttr (@{$hwpfAttributes{attribute}}) { my $hbFapiId = $hbAttr->{hwpfToHbAttrMap}[0]->{id}; @@ -217,7 +217,7 @@ foreach my $ekbEnum (@{$allEKBAttributes->{enumerationType}}) my $ekbEnumId = $ekbEnum->{id}; my $theHbEnum; #we dont want to add duplicates so check if the enumeration exists already in HB - foreach my $hbEnum (@{%$allHBAttributes->{enumerationType}}) + foreach my $hbEnum (@{$allHBAttributes->{enumerationType}}) { my $hbEnumId = $hbEnum->{id}; diff --git a/src/usr/targeting/common/xmltohb/handle_fapi_attr_mapping.pl b/src/usr/targeting/common/xmltohb/handle_fapi_attr_mapping.pl index 05b2cb7fd..e1f8f7542 100755 --- a/src/usr/targeting/common/xmltohb/handle_fapi_attr_mapping.pl +++ b/src/usr/targeting/common/xmltohb/handle_fapi_attr_mapping.pl @@ -113,7 +113,7 @@ foreach my $attribute (@{$allAttributes->{attribute}}) { if (exists $attribute->{hwpfToHbAttrMap} ) { - push (@{%hwpfAttributes->{attribute}}, $attribute); + push (@{$hwpfAttributes{attribute}}, $attribute); } } @@ -192,7 +192,7 @@ foreach my $targetType ( @{$srcTargetTypes->{targetType}}) } if($id eq $NewAttr[$i][0]) { - push (@{%$targetType->{attribute}}, \%attrHash); + push (@{$targetType->{attribute}}, \%attrHash); } } } @@ -205,7 +205,7 @@ foreach my $targetType (@{$srcTargetTypes->{targetType}}) foreach my $attribute (@{$targetType->{attribute}}) { #check if there is a hostboot mapping w/ a different name - foreach my $hbMappedAttr (@{%hwpfAttributes->{attribute}}) + foreach my $hbMappedAttr (@{$hwpfAttributes{attribute}}) { my $fapiAttrId = $hbMappedAttr->{hwpfToHbAttrMap}[0]->{id}; $fapiAttrId = substr $fapiAttrId , 5; diff --git a/src/usr/targeting/xmltohb/fapi_utils.pl b/src/usr/targeting/xmltohb/fapi_utils.pl old mode 100755 new mode 100644 index 7ba1c1fb1..de451b35e --- a/src/usr/targeting/xmltohb/fapi_utils.pl +++ b/src/usr/targeting/xmltohb/fapi_utils.pl @@ -1,3 +1,4 @@ +#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # @@ -24,10 +25,12 @@ # IBM_PROLOG_END_TAG # A collection of utility functions to convert fapi attributes to targeting attributes -$XML::Simple::PREFERRED_PARSER = 'XML::Parser'; -my $xml = new XML::Simple (KeyAttr=>[]); +use XML::Simple; use Digest::MD5 qw(md5_hex); use strict; +$XML::Simple::PREFERRED_PARSER = 'XML::Parser'; +my $xml = new XML::Simple (KeyAttr=>[]); + # Convert a FAPI2 target type to the equivalent TARGETING type # Input: fapi2 type @@ -360,7 +363,7 @@ sub getArrayDimmensions{ my (%attrHash) = @_; my $retValue = ""; - my $simpleType = %attrHash->{simpleType}; + my $simpleType = $attrHash{simpleType}; my @keys = keys (%$simpleType); @@ -368,7 +371,7 @@ sub getArrayDimmensions{ { if( $key eq "array") { - $retValue .= %attrHash->{simpleType}->{$key}; + $retValue .= $attrHash{simpleType}->{$key}; } } #eat whitespace @@ -407,7 +410,7 @@ sub getAttrType { my (%attrHash) = @_; my $retValue = ""; - my $simpleType = %attrHash->{simpleType}; + my $simpleType = $attrHash{simpleType}; my @keys = keys (%$simpleType); -- cgit v1.2.1