C-Duv/sysadmin-scripts

duplicityBackup: "Type of arg 1 to each must be hash/array"

C-Duv opened this issue · 2 comments

On Perl v5.10.1 I get the following errors:

Type of arg 1 to keys must be hash (not hash element) at ./duplicityBackup line 541, near "}) "
Type of arg 1 to each must be hash (not array slice) at ./duplicityBackup line 642, near "])"
Type of arg 1 to each must be hash (not array slice) at ./duplicityBackup line 711, near "])"
Type of arg 1 to keys must be hash (not private variable) at ./duplicityBackup line 825, near "$storageOptions)"
Type of arg 1 to push must be array (not hash element) at ./duplicityBackup line 1409, near "$currentServiceId)"
Type of arg 1 to keys must be hash (not scalar dereference) at ./duplicityBackup line 1445, near "$serviceRuns) "
Type of arg 1 to keys must be hash (not scalar dereference) at ./duplicityBackup line 1449, near "$storagesToUse) "
Type of arg 1 to keys must be hash (not scalar dereference) at ./duplicityBackup line 1458, near "$serviceRuns) "
Type of arg 1 to keys must be hash (not scalar dereference) at ./duplicityBackup line 1458, near "$serviceRuns)"
Type of arg 1 to keys must be hash (not hash element) at ./duplicityBackup line 1458, near "}) "
./duplicityBackup has too many errors.

But not on version 5.14.2.

According to perldoc:

Starting with Perl 5.14, keys can take a scalar EXPR, which must contain a reference to an unblessed hash or array. The argument will be dereferenced automatically. This aspect of keys is considered highly experimental. The exact behaviour may change in a future version of Perl.

Source: http://stackoverflow.com/questions/20824920/perl-array-references-and-avoiding-type-of-arg-1-to-keys-must-be-hash-error

Fixed with 6b2aa6f.