views:

88

answers:

1

I've inherited some Perl code that makes a web service call to Microsoft's Mappoint wbeservice, but after a recent upgrade, it's started failing with the ever cryptic:

Not a HASH reference at /usr/lib/perl5/site_perl/5.8.0/WebService/Mappoint.pm line 35.

Without posting the full code of the module (after all, WebService::Mappoint is available via CPAN), the line in question is the last below:

package WebService::Mappoint;
use SOAP::Lite;
use FileHandle;
use fields qw(ini_file remote_object CustomerInfoHeader UserInfoHeader);
use vars qw(%FIELDS);
use vars qw($VERSION);
$VERSION=0.30;

# @drawmap_EU might be incomplete. It might also contain values that should not be here. Please let me know if there is something wrong
my @EU = (qw(
ad al am at az by ba be bg hr ch cy cz de dk ee es fo fr fi gb ge gi gr hu is ie it lv lt lu mt nl no pl pt ro sk si se tr ua uk yu
));
my %EU;
my %NA = (us=>1, ca=>1, mx=>1);

use strict;

my $ini_files = {};
my ( $user, $password );

my $default_ini_path;

BEGIN {

   $default_ini_path = $^O =~ m/windows/i ? 'c:\mappoint.ini' : '/etc/mappoint.ini';
}

##############################################################################
sub new {
    my ( $class, $proxy_url, $inifile_path ) = @_;

    no strict 'refs';
    my $self = bless [\%{"${class}::FIELDS"}], $class;

Whilst I can pick my way through enough Perl to get by, I'm a bit stumped as to why this is causing problems, although I thought that you could only bless hashes, and that appears to be an anonymous array?

+3  A: 

It looks like using of pseudo-hashes. Array reference is stored in $self, but it used as hash reference later. Pseudo-hashes are depricated now. I suggest you patch the module to use normal hashes. Not sure if it'll help:

my $self = bless { %{"${class}::FIELDS"} }, $class;
Ivan Nevostruev