That's odd. The routes are just saved and rerun every time, but they're enclosed scopes so that shouldn't happen.
I'm probably too tired and not smart enough to clearly see something simple that's happening here.

My suggestion is: close the damn filehandle when you're done with it! :)

Sawyer.

On Tue, Feb 15, 2011 at 3:22 PM, Thomas Maier <hayzer@gmail.com> wrote:
Hi,
I have the follow route:
{{{

get qr{/(tests/.*)} => sub {
   my ($filename) = splat;
   my $testdata = {};
   open my $stdout, "-|", "cli","--flag",$filename;
   while(<$stdout>) {
       my ($id,$name) = split/:/,$_;
       $testdata->{$id} = qq{$name};
   }
   template 'show_test_case', {
       filename => $filename,
       testdata => $testdata,
   };
};

}}}

Following the route (/tests/something) for the first time gives the
expected results, meaning the list of $id's and $name's.
But when executing the route for the second time, it shows the follow
runtime error:
"
Warning caught during route execution: readline() on closed filehandle $stdout
"

Is there some limitation for working with filehandlers withing the route
subroutine?

Thomas
_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users