On 10/25/2011 03:40 PM, Puneet Kishor wrote:
Is something like the following possible (see the line marked />+/)? Or, even advisable?
get '/foo.:format' => sub { my $a = param 'a'; my $b = param 'b';
my $res = query_db($a, $b); return to_json $res; }
get '/bar.:format' => sub { my $a = param 'a'; my $b = param 'b';
> my $res_foo =<somehow call /foo.json?a=$a&b=$b>; my $res = do_something($res_foo); return to_json $res; }
I suggest to make a function like that: sub abjson { my ($a, $b) = @_; my $res = query_db($a, $b); return to_json $res; } You can call this function from both routes. Regards Racke -- LinuXia Systems => http://www.linuxia.de/ Expert Interchange Consulting and System Administration ICDEVGROUP => http://www.icdevgroup.org/ Interchange Development Team