pjf / WebService-HabitRPG

Access the HabitRPG API from Perl
8 stars 5 forks source link

Attempts to make objects out of undef objects #27

Closed pjf closed 11 years ago

pjf commented 11 years ago

@wizonesolutions has reported a weird bugs which seems to be related to something odd happening with calling our task search functionality. Currently trying to reproduce.

(13:39:59) wizonesolutions: Use of uninitialized value in string eq at /Users/kevin/perl5/perlbrew/perls/perl-5.16.3padre/lib/site_perl/5.16.3/WebService/HabitRPG.pm line 126.

https://dl.dropbox.com/u/17934449/HabitRPG.pm

(13:49:43) wizonesolutions: for command, I am using hrpg --dev +1h (13:49:51) wizonesolutions: I think the task description could be swapped out for anything (13:49:56) wizonesolutions: and doesn't need to be dev (13:50:03) wizonesolutions: but you asked for exact command, thus hence (13:50:08) wizonesolutions: good night (13:50:40) pfenwick: wizonesolutions: OOooooh! (13:50:51) wizonesolutions: oh wait (13:50:54) wizonesolutions: there is a space in my command (13:50:56) pfenwick: wizonesolutions: '+1h', no spaces? (13:50:58) wizonesolutions: oh wait I typed it with that (13:51:11) wizonesolutions: no I put spaces I am pretty sure...let me double check (13:51:14) wizonesolutions: I have done that before (13:51:28) wizonesolutions: I think I get a different error if I forget the space though (13:51:30) pfenwick: wizonesolutions: Could you try hrpg + 1h', if the command is supposed to be '1h'? (13:51:57) pfenwick: wizonesolutions: I recently added it so you could dohrpg +5 Exercisefor example, and it would increment the exercise goal five times. (13:52:08) wizonesolutions: yeah same thing with the space (13:52:11) pfenwick: So I'm guessing it's getting confused by seeing the +/- followed by a number. :) (13:52:11) wizonesolutions: yep I have used that feature :) (13:52:21) wizonesolutions: oh! let me try it with a string... (13:52:38) wizonesolutions: nope, happens even with nonexistent tasks (13:52:47) wizonesolutions:hrpg --dev + idonethis` (13:52:51) wizonesolutions: should say nothing matched (13:52:54) wizonesolutions: but I get the error (13:52:58) pfenwick: wizonesolutions: Awesome! (13:53:06) wizonesolutions: +1 idonethis fails also, for reference :)

pjf commented 11 years ago

Possible options:

The only place we do string comparison operations is in the search_tasks, so despite the weird line number I suspect that's the first place to look.

Things to do:

wizonesolutions commented 11 years ago

@pjf: I installed 5.16.2 clean and installed WebService::HabitRPG on that just to test if it was the Perl version. Still had the issue. I'll try running it with the debug flag you mentioned on IRC (will have to look it up later).

pjf commented 11 years ago

Fixed. Somehow (and I have no idea how) were were seeing a null or otherwise empty task coming out of the JSON. We now explicitly skip null tasks, which seems to have resolved this.