Skip Menu |

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

Report information
The Basics
Id: 56365
Status: resolved
Priority: 0/
Queue: Games-WoW-Armory

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

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



Subject: working patch for current Armory version
Date: Wed, 7 Apr 2010 23:12:41 +0300
To: bug-Games-WoW-Armory [...] rt.cpan.org
From: Ratiu Petru <rpetre [...] gmail.com>
Hello, Here's a patch I made today that manages to pass the testsuite. I modified the testsuite a bit, using an active character and one of its arena teams. I haven't done testing further than what was in the testcase. I used perl 5.10.1 for i486-linux-gnu-thread-multi to test it (but it shouldn't mater much). Thanks!

Message body is not shown because sender requested not to inline it.

Subject: [rt.cpan.org #56365] working patch for current Armory version
Date: Wed, 7 Apr 2010 23:36:13 +0300
To: bug-Games-WoW-Armory [...] rt.cpan.org
From: Ratiu Petru <rpetre [...] gmail.com>
Sorry, I sent an empty file, here's the patch, inline: diff --git a/lib/Games/WoW/Armory.pm b/lib/Games/WoW/Armory.pm index b442b49..db5c75c 100644 --- a/lib/Games/WoW/Armory.pm +++ b/lib/Games/WoW/Armory.pm @@ -341,7 +341,7 @@ sub get_arena_teams { # than one team. The following logic tries to figure this out: my @teams = ( exists $$arena_team{name} ) ? ( $arena_team ) - : map { $$arena_team{$_} } keys %{$arena_team}; + : map +{ %{$arena_team->{$_}}, name=>$_ }, (keys %{$arena_team}); my @team_objs; foreach my $team ( @teams ){ @@ -359,6 +359,9 @@ sub get_arena_teams { my @members; my $members = $$team{members}{character}; + + if (defined $members->{name} ) { my %hash = %$members ; delete $hash{name}; $members = { $members->{name} => \%hash } }; + foreach my $member (keys %{$members}){ my $m = Games::WoW::Armory::Character->new; $m->name($member); @@ -397,13 +400,13 @@ sub search_guild { ); $self->guild( Games::WoW::Armory::Guild->new ); - my $guild = $self->{ data }{ guildInfo }{ guild }; + my $guild = $self->{ data }{ guildInfo }; my $members = $self->{ data }{ guildInfo }{ guild }{ members }{ character }; - $self->guild->name( $$guild{ name } ); - $self->guild->battleGroup( $$guild{ battleGroup } ); - $self->guild->realm( $$guild{ realm } ); + $self->guild->name( $$guild{ guildHeader }{ name } ); + $self->guild->battleGroup( $$guild{ guildHeader }{ battleGroup } ); + $self->guild->realm( $$guild{ guildHeader }{ realm } ); my @members; foreach my $member ( keys %{ $members } ) { diff --git a/t/01.armory.t b/t/01.armory.t index aef8baf..74b8712 100644 --- a/t/01.armory.t +++ b/t/01.armory.t @@ -11,10 +11,10 @@ can_ok('Games::WoW::Armory', 'search_character'); can_ok('Games::WoW::Armory', 'search_guild'); my $char = Games::WoW::Armory->new(); -$char->search_character({realm => "Elune", character => "Aarnn", country => "EU"}); -is ($char->character->{name}, "Aarnn", "Character name ok"); -is ($char->character->name, "Aarnn", "New character name ok"); -is ($char->character->level, 70, "New characterlevel ok"); +$char->search_character({realm => "Elune", character => "Astelian", country => "EU"}); +is ($char->character->{name}, "Astelian", "Character name ok"); +is ($char->character->name, "Astelian", "New character name ok"); +is ($char->character->level, 80, "New characterlevel ok"); isa_ok ($char->character->reputation, 'HASH', 'Reputation' ); isa_ok ($char->character->arenaTeams, 'ARRAY', 'Arena Teams'); @@ -22,11 +22,11 @@ my $guild = Games::WoW::Armory->new(); $guild->search_guild({realm => "Elune", guild => "Cercle+De+L+Anneau+Rond", country => "EU"}); is ($guild->guild->name, "Cercle De L Anneau Rond", "Guild name"); is ($guild->guild->realm, "Elune", "Realm name"); -is ($guild->guild->battleGroup, "Cataclysme", "Battlegroup name"); +is ($guild->guild->battleGroup, "Cataclysme / Cataclysm", "Battlegroup name"); my $arena = Games::WoW::Armory->new(); -$arena->search_team({team => 'prouteam', ts => 2, country => 'EU', realm => 'Elune'}); -is ($arena->team->name, 'prouteam', 'Team name'); +$arena->search_team({team => 'Ne me kitte pas', ts => 2, country => 'EU', realm => 'Elune'}); +is ($arena->team->name, 'Ne me kitte pas', 'Team name'); is ($arena->team->size, 2, 'Team Size'); -is ($arena->team->battleGroup, 'Cataclysme', 'Battlegroup name'); +is ($arena->team->battleGroup, 'Cataclysme / Cataclysm', 'Battlegroup name'); is ($arena->team->realm, 'Elune', 'Realm name');
I uploaded version 0.0.7_1 that includes this patch.