Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-ActionDispatch CPAN distribution.

Report information
The Basics
Id: 41345
Status: resolved
Priority: 0/
Queue: CGI-Application-Plugin-ActionDispatch

People
Owner: Nobody in particular
Requestors: KILINRAX [...] cpan.org
Cc:
AdminCc:

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



Subject: Path regex matching gives warnings when @args is empty
If there are no action args for a path, then ActionDispatch gives the following warning: [Mon Dec 1 11:19:48 2008] search.t: Use of uninitialized value in substitution (s///) at .../local/lib/site_perl/5.8.8/CGI/Application/Plugin/ActionDispatch.pm line 119. [Mon Dec 1 11:19:48 2008] search.t: Use of uninitialized value in split at .../local/lib/site_perl/5.8.8/CGI/Application/Plugin/ActionDispatch.pm line 120. The following patch prevents it: --- CGI/Application/Plugin/ActionDispatch.pm.old Sat Sep 20 17:31:48 2008 +++ CGI/Application/Plugin/ActionDispatch.pm Mon Dec 1 11:15:05 2008 @@ -115,7 +115,7 @@ # done by counting the args, and finding the Path with # the fewest amount of args left over. if($type eq 'Path') { - if(@args) { + if(defined($args[0])) { $args[0] =~ s/^\///; @path_args = split('/', $args[0]); }
Why is the bug marked "unimportant". Seems pretty sloppy to me.
On Wed Jun 02 07:15:00 2010, SILASMONK wrote: Show quoted text
> Why is the bug marked "unimportant". Seems pretty sloppy to me.
I have no idea. Maybe me ignoring it for so long made the system automatically mark it as "unimportant"? Anyways I fixed the problem. It is already updated on github. http://github.com/jaywhy/cgi-application-plugin-actiondispatch And I will update it on CPAN also. Thanks for the reminder.
Actually looking at this a second time, I realized using "defined(@args)" shouldn't fix anything, as without the "defined" it should work the same as with it; in fact, "defined" against an array is deprecated. Hmm. I know it has been a long time, but can you give me further information on this bug. My Perlfoo is completely out of practice.
On Wed Jun 02 10:05:31 2010, JAYWHY wrote: Show quoted text
> Actually looking at this a second time, I realized using > "defined(@args)" shouldn't fix anything
The fix is to use 'defined($args[0])' not 'defined(@args)', since it's the usage of a potentially-undefined '$args[0]' in the following two lines that throws warnings: $args[0] =~ s/^\///; @path_args = split('/', $args[0]);
On Wed Jun 02 10:22:25 2010, KILINRAX wrote: Show quoted text
> On Wed Jun 02 10:05:31 2010, JAYWHY wrote:
> > Actually looking at this a second time, I realized using > > "defined(@args)" shouldn't fix anything
> > The fix is to use 'defined($args[0])' not 'defined(@args)', since it's > the usage of a potentially-undefined '$args[0]' in the following two > lines that throws warnings: > > $args[0] =~ s/^\///; > @path_args = split('/', $args[0]);
LOL. Foot put in mouth. Thanks again for the patch, I will update today hopefully correctly ;).