I'm building a webapp using dancer2 as backend tool. I've implemented the main method as follow:
#!/usr/bin/env perl
use Dancer2;
get '/mything/:text' => sub {
my @myArray = ("");
# Fill the array with DB data;
return join "<br>", @myArray;
};
dance;
Everything is fine until the second time get method is used. Insted of @myArray
being empty, its filled with the from the first execution.
As a dirty fix, I initialize @myArray
to ("")
at the end of the method, but I think that is ugly. Have you any experience on this?