Skip Menu |

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

Report information
The Basics
Id: 30329
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 search_character for low level characters
For reference the issue is with Kundari of Gorgonnash, L17 US server. The API croaks during a ->search_character(). Specifically, in the get_heroic_access subcall. Line 482, 'Can't use string ("Alliance") as a HASH ref while "strict refs" in use at cpan/lib/Games/WoW/Armory.pm line 482.' The module appears to be attempting to de-referencing the character- Show quoted text
>reputation->{$rep}->{$fac}->{'faction'} when $rep is pointing to a
scalar, and not a hash-ref. Examination of other successful searches, indicates the data structure isn't being built properly. A working character's data structure is : { reputation => { factionCategory => { "$FactionGroupName1" => { ... }, "$FactionGroupName2" => { ... }, etc. } }, } The invalid case that I'm running into looks more like: { reputation => { factionCategory => { name => 'Alliance', faction => { ... }, key => 'alliance', } }, } Essentially, in the first (working) example, there is an Alliance faction *group* and it is properly formed in a sub-hash, in the non- working case, this Alliance faction is at the root of the factionCategory hash structure. The problem appears to be that the armory does not list the factions in groups if the player has yet to run into a faction that is not of their main group, ie Alliance/Horde. This makes sense given that this character is only lvl 17 and hasn't battleground or performed any goblinesque quests. A solution might be just to hack on a group name if there is no listed group name, as there should only be two cases, Alliance or Horde. Dumper output of the entire WoW::Armory object just before the get_heroic_access() call is attached. Thanks for your time.
Subject: dumper_kudari_gorgonnash_us_20071028.txt

Message body is not shown because it is too large.

From: dekimsey [...] gmail.com
An attempt at a patch, appears to work. But I'm not certain if the logic is in the correct place, or if there are other possible ways for the same code to break.
--- Armory.pm.org 2007-10-28 22:06:38.395064500 -0400 +++ Armory.pm 2007-10-28 22:04:47.760150250 -0400 @@ -311,6 +311,21 @@ my $reputation = $self->{ data }{ characterInfo }{ reputationTab }; + # patch for rt#30329 + my $workaround = $reputation->{ 'factionCategory' }; + if( exists $workaround->{ 'name' } ) { + # this is an invalid data structure. + delete $workaround->{'name'}; + my $newhash = $workaround; + # lazy titlecasing of {'key'} + my $key = 'Alliance'; + if ( $workaround->{'key'} eq 'horde' ) { + $key = 'Horde'; + } + $reputation->{'factionCategory'} = { $key => $newhash }; + } + # /patch for rt#30329 + $self->character->reputation( $reputation ); $self->get_heroic_access; }
From: dekimsey [...] gmail.com
Errr... don't look at that previous patch... I ditzed out and completely forgot about ucfirst and wrote some pretty stupid code to deal with the fact. sigh. On Sun Oct 28 22:26:45 2007, dekimsey wrote: Show quoted text
> An attempt at a patch, appears to work. But I'm not certain if the > logic is in the correct place, or if there are other possible ways
for Show quoted text
> the same code to break.
--- Armory.pm.org 2007-10-28 22:06:38.395064500 -0400 +++ Armory.pm 2007-10-28 22:04:47.760150250 -0400 @@ -311,6 +311,21 @@ my $reputation = $self->{ data }{ characterInfo }{ reputationTab }; + # patch for rt#30329 + my $workaround = $reputation->{ 'factionCategory' }; + if( exists $workaround->{ 'name' } ) { + # this is an invalid data structure. + delete $workaround->{'name'}; + my $newhash = $workaround; + # lazy titlecasing of {'key'} + my $key = ucfirst $workaround->{'key'}; + $reputation->{'factionCategory'} = { $key => $newhash }; + } + # /patch for rt#30329 + $self->character->reputation( $reputation ); $self->get_heroic_access; }