Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer-Plugin-SiteMap CPAN distribution.

Report information
The Basics
Id: 91176
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-SiteMap

People
Owner: Nobody in particular
Requestors: keith [...] beyondthevolga.com
Cc:
AdminCc:

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



Subject: Ajax/get on route generates duplicate entry
Date: Wed, 04 Dec 2013 15:19:26 +0000
To: <bug-Dancer-Plugin-SiteMap [...] rt.cpan.org>
From: Keith Jones <keith [...] beyondthevolga.com>
Hello I am using Dancer::Plugin::SiteMap 0.11 with Dancer::Plugin::Ajax under perl 5.14.2 on Debian 7.1 and am finding that any routes where I have both a sub for Ajax and get causes duplicate entries in the generated site map. For now I have changed the module to dedupe the output but I would prefer a more permanent solution. Let me know if you want more information. Regards Keith
Hi Keith, On Wed Dec 04 10:19:41 2013, keith@beyondthevolga.com wrote: Show quoted text
> Hello > > I am using Dancer::Plugin::SiteMap 0.11 with Dancer::Plugin::Ajax under > perl 5.14.2 on Debian 7.1 and am finding that any routes where I have both > a sub for Ajax and get causes duplicate entries in the generated site map. > For now I have changed the module to dedupe the output but I would prefer a > more permanent solution. Let me know if you want more information.
Thanks for the bug report. Obviously the behaviour you've reported is undesirable. To that end, I've looked into adding some code to de-dupe the site map entries. However, I've not used the Ajax module with Dancer myself, so to ensure that my fix corrects your issue (without breaking the site map module :) ) I'd like to test it. Could you supply me a sample app with the ajax and get subs in the way you're using them so I can see exactly what you're doing and ensure there's no hidden voodoo within Dancer that is affecting the route list code. I'll attempt to test it in the mean time, but your help on this would be greatly appreciated. As soon as I can verify that the issue is resolved and everything is working as expected, I'll push a new version to CPAN. Cheers, JamesR
Subject: Re: [rt.cpan.org #91176] Ajax/get on route generates duplicate entry
Date: Thu, 05 Dec 2013 14:31:09 +0000
To: bug-Dancer-Plugin-SiteMap [...] rt.cpan.org
From: Keith Jones <keith [...] beyondthevolga.com>
Hello James if you're simply adding something like: my %seen = (); @urls = grep { !$seen{$_}++ } @urls; return sort(@urls); to the end of _retrieve_get_urls then that's what I've done and it works. If you're looking at doing something fancier then I will certainly supply a sample app. Regards, Keith On 05/12/2013 13:06, James Ronan via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=91176 > > > Hi Keith, > > On Wed Dec 04 10:19:41 2013, keith@beyondthevolga.com wrote:
>> Hello >> >> I am using Dancer::Plugin::SiteMap 0.11 with Dancer::Plugin::Ajax under >> perl 5.14.2 on Debian 7.1 and am finding that any routes where I have both >> a sub for Ajax and get causes duplicate entries in the generated site map. >> For now I have changed the module to dedupe the output but I would prefer a >> more permanent solution. Let me know if you want more information.
> > Thanks for the bug report. Obviously the behaviour you've reported is undesirable. To that end, I've looked into adding some code to de-dupe the site map entries. > > However, I've not used the Ajax module with Dancer myself, so to ensure that my fix corrects your issue (without breaking the site map module :) ) I'd like to test it. > > Could you supply me a sample app with the ajax and get subs in the way you're using them so I can see exactly what you're doing and ensure there's no hidden voodoo within Dancer that is affecting > the route list code. > > I'll attempt to test it in the mean time, but your help on this would > be greatly appreciated. > > As soon as I can verify that the issue is resolved and everything is working as expected, I'll push a new version to CPAN. > > Cheers, > JamesR > >
Hi Keith, On Thu Dec 05 09:31:25 2013, keith@beyondthevolga.com wrote: Show quoted text
> Hello James > > if you're simply adding something like: > > my %seen = (); > @urls = grep { !$seen{$_}++ } @urls; > return sort(@urls); > > to the end of _retrieve_get_urls then that's what I've done and it > works. If you're looking at doing something fancier then I will > certainly supply a sample app.
Actually, I've added: # Only add any given route once. next get_route if grep { $_ eq $pattern } @urls; to the for loop so it doesn't add dupes in the first place ;) But I have just knocked up a quick test app which uses the Ajax plugin and defines routes for both get and ajax. I'm happy to say that I've replicated your issue, and my fix does indeed work, so I'll push a new version shortly. Thanks again for the bug report. I'll close this ticket when I've released the new version. Cheers, JamesR
Subject: Re: [rt.cpan.org #91176] Ajax/get on route generates duplicate entry
Date: Thu, 05 Dec 2013 14:43:32 +0000
To: bug-Dancer-Plugin-SiteMap [...] rt.cpan.org
From: Keith Jones <keith [...] beyondthevolga.com>
Hello James yours is a much better solution than mine so thanks for that and I look forward to grabbing the new version. There may be another bug but I want to nail the cause before I raise it formally. Regards, Keith On 05/12/2013 14:38, James Ronan via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=91176 > > > Hi Keith, > > On Thu Dec 05 09:31:25 2013, keith@beyondthevolga.com wrote:
>> Hello James >> >> if you're simply adding something like: >> >> my %seen = (); >> @urls = grep { !$seen{$_}++ } @urls; >> return sort(@urls); >> >> to the end of _retrieve_get_urls then that's what I've done and it >> works. If you're looking at doing something fancier then I will >> certainly supply a sample app.
> Actually, I've added: > > # Only add any given route once. > next get_route if grep { $_ eq $pattern } @urls; > > to the for loop so it doesn't add dupes in the first place ;) > > But I have just knocked up a quick test app which uses the Ajax plugin and defines routes for both get and ajax. I'm happy to say that I've replicated your issue, and my fix does indeed work, so I'll push a new version shortly. > > Thanks again for the bug report. I'll close this ticket when I've released the new version. > > Cheers, > JamesR > > >
Hi Keith, On Thu Dec 05 09:43:48 2013, keith@beyondthevolga.com wrote: Show quoted text
> Hello James > > yours is a much better solution than mine so thanks for that and I > look > forward to grabbing the new version. > > There may be another bug but I want to nail the cause before I raise > it > formally.
The new release 0.12 is up: https://metacpan.org/release/JAMESR/Dancer-Plugin-SiteMap-0.12 Please do let me know if you've found another bug - Either let me know what it is, or feel free to raise it on here and submit a PR directly on the GitHub repo (if you're a GitHub user, of course): https://github.com/jamesronan/Dancer-Plugin-SiteMap Thanks again, JamesR