From bd7d57b6aa7a1af31dc38384683a225c8e1ec02f Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 30 Nov 2013 16:27:02 -0800 Subject: [PATCH 1/1] initial commit that actually works --- Makefile.PL | 4 +++- WebSmart.pm | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 94fd136..22ec7f4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -13,7 +13,9 @@ WriteMakefile( : ()), PL_FILES => {}, PREREQ_PM => { - 'Test::More' => 0, + 'Test::More' => 0, + 'XML::LibXML' => 2, + 'LWP::UserAgent' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Geo-Melissa-WebSmart-*' }, diff --git a/WebSmart.pm b/WebSmart.pm index c54ee19..ddc89cf 100644 --- a/WebSmart.pm +++ b/WebSmart.pm @@ -92,7 +92,7 @@ sub query { $root = $root->firstChild; # ResponseArray my $data = treeify($root); if (exists $data->{Record}) { - $self->address($data->{Address}); + $self->address($data->{Record}->{Address}); $self->code($data->{Record}->{Results}); } else { $self->code($data->{Results}); @@ -100,7 +100,7 @@ sub query { } else { $self->message( $resp->status_line ); } - if ( $geocode and $self->address and $self->address->{AddressKey} > 0 ) { + if ( $geocode and $self->address->{AddressKey} ) { $uri = URI->new($geocoder_uri); $uri->query_form( id => $opt{id}, @@ -199,11 +199,12 @@ error or warning messages. sub status_message { my $self = shift; - join("\n", - $self->message, + my $status = join("\n", map { $self->result_string($_) } split(',', $self->code) ); + $status = join("\n", $self->message, $status) if $self->message and $status; + $status; } =head2 result_string CODE -- 2.11.0