This is the ideal case to add:
use strict;
use warnings;
Also, I think you want an if, not a while (strict/warnings would not have caught the infinite loop tho):
while ( my $q = new CGI::Fast ) {
my $query = $q->param('node');
print "Content-type: text/plain\n\n";
++$n;
print "You are request number $n. Have a good day!\n";
print "query: $query\n";
$nodes{ exists $nodes{$query} ? $query : '_err' }();
print "done!\n";
}
Update:
You're not actually calling do_something in any execution path. And you don't need to use CGI in your package just to get the query option. You should be able to get it in the call to CGI::Fast and pass it to a method in your package, assuming you actually call it.
Maybe nodes{ exists $nodes{$query} ? $query : '_err' }(); needs to be nodes{ exists $nodes{$query} ? $query : '_err' }->(); ... sorry missed that it was a real hash.
Yeah you got a lot going on. Simplify it. Get rid of the package stuff, make sure your dispatching is clear, and make sure one of your terminal methods actually terminates. Hard to tell at first glance, but I still think your while is causing you some grief. |