Subject: | No ref checking in _process_element_hash |
_process_element_hash seems to wrongfully assume that $Obj is going to
be a HASH ref, and that's not always the case:
{"resp": {"status": true, "version": "2.0", "artist": {"profile":
"Wouter DeBacker (born 21st of May, 1980), more commonly known by the
stage name Gotye, is an ARIA Award-winning singer-songwriter. Born in
Belgium but based in the Australian city of Melbourne, Gotye describes
his work as \"about refiguring past things (old vinyl sounds) with my
own ideas\".", "releases_url":
"http://api.discogs.com/artists/267609/releases", "name": "Gotye",
"groups": ["Basics, The"], "uri": "http://www.discogs.com/artist/Gotye",
"urls": ["http://www.gotye.com", "http://www.myspace.com/gotye",
"http://www.facebook.com/gotye", "http://twitter.com/gotye",
"http://soundcloud.com/gotye"], "images": [{"uri":
"http://api.discogs.com/image/A-267609-1318999838.jpeg", "height": 366,
"width": 486, "resource_url":
"http://api.discogs.com/image/A-267609-1318999838.jpeg", "type":
"secondary", "uri150":
"http://api.discogs.com/image/A-150-267609-1318999838.jpeg"}, {"uri":
"http://api.discogs.com/image/A-267609-1325773251.jpeg", "height": 590,
"width": 590, "resource_url":
"http://api.discogs.com/image/A-267609-1325773251.jpeg", "type":
"primary", "uri150":
"http://api.discogs.com/image/A-150-267609-1325773251.jpeg"}, {"uri":
"http://api.discogs.com/image/A-267609-1325773257.jpeg", "height": 304,
"width": 420, "resource_url":
"http://api.discogs.com/image/A-267609-1325773257.jpeg", "type":
"secondary", "uri150":
"http://api.discogs.com/image/A-150-267609-1325773257.jpeg"}, {"uri":
"http://api.discogs.com/image/A-267609-1325773265.jpeg", "height": 543,
"width": 450, "resource_url":
"http://api.discogs.com/image/A-267609-1325773265.jpeg", "type":
"secondary", "uri150":
"http://api.discogs.com/image/A-150-267609-1325773265.jpeg"}, {"uri":
"http://api.discogs.com/image/A-267609-1325773278.jpeg", "height": 750,
"width": 500, "resource_url":
"http://api.discogs.com/image/A-267609-1325773278.jpeg", "type":
"secondary", "uri150":
"http://api.discogs.com/image/A-150-267609-1325773278.jpeg"}],
"resource_url": "http://api.discogs.com/artists/267609", "aliases":
["Wally De Backer"], "id": 267609, "data_quality": "Needs Vote",
"realname": "Wouter DeBacker"}}}loaded module: JSON
at
XML::XML2JSON::_init(/usr/local/share/perl/5.10.1/XML/XML2JSON.pm:164)
at
XML::XML2JSON::new(/usr/local/share/perl/5.10.1/XML/XML2JSON.pm:124)
at main::artist_xml(musicsort.pl:704)
at main::(musicsort.pl:626)
ERROR: Can't use string ("http://www.gotye.com") as a HASH ref while
"strict refs" in use at /usr/local/share/perl/5.10.1/XML/XML2JSON.pm
line 805.
The problem area is here:
"urls": ["http://www.gotye.com", "http://www.myspace.com/gotye",
"http://www.facebook.com/gotye", "http://twitter.com/gotye",
"http://soundcloud.com/gotye"]
Just because it's an ARRAY doesn't mean it's going to have HASHs inside.
This should really turn into multiple <urls> tags.