Skip Menu |

This queue is for tickets about the Games-WoW-Armory CPAN distribution.

Report information
The Basics
Id: 30330
Status: new
Priority: 0/
Queue: Games-WoW-Armory

People
Owner: Nobody in particular
Requestors: dekimsey [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.0.7
Fixed in: (no value)



Subject: croak in get_arena_teams when only one team member
Error: 'Can't use string ("7") as a HASH ref while "strict refs" in use at cpan/lib/Games/WoW/Armory.pm line 394.' Similar to rt#30329, the hash ( $$team{members}{character} ) is improperly formed when the team consists of only one member. Instead of it having multiple hashes keyed on the member name, the entire member's data is in the root {members}{character} hash. Thus the subsequent attempts to dereference fail.
From: dekimsey [...] gmail.com
Patch attempt, not sure if I'm doing this in the right place. But the sub appears to complete properly now...
--- Armory.pm.org 2007-10-28 22:06:38.395064500 -0400 +++ Armory.pm 2007-10-28 22:40:10.888837500 -0400 @@ -360,6 +375,17 @@ my @members; my $members = $$team{members}{character}; + # patch rt#30330 + # members of a one-man team, croak, as the hash is improperly formed. + my ($akey) = keys %{$members}; + if( not ref $$members{$akey} ) { + # not a ref, improper hash. + my $copy = {%{$members}}; + my $name = $$members{name}; + $$team{members}{character} = { $name => $copy }; + $members = $$team{members}{character}; + } + # /patch rt#30330 foreach my $member (keys %{$members}){ my $m = Games::WoW::Armory::Character->new; $m->name($member);