This simplification of your code works fine:
use strict;
use warnings;
use URI;
use URI::QueryParam;
my $uri = URI->new("http://www.foo.com?bar=baz&sproing=blargh");
for my $key ($uri->query_param) {
print "$key\n";
}
Output:
bar
sproing
The problem is almost certainly with your data: your URL isn't correctly formatted or doesn't have any parameters.