Thank you David and Rik for your answers,<div> I have one more question, I tried executing some perl code from a ajax routine :</div><div>something like :</div>
<div><br></div><div><i>sub get_stats {</i></div><div><i># some perl code goes here </i></div><div><i> ## open a file using perl file open</i></div><div><i> ## use dancer logger to output to console</i></div><div><i> ## execute shell commands using system call of perl</i></div>
<div><i>}</i></div><div><i><br></i></div><div><div><i>ajax '/killprocess' => sub {</i></div><div><i> get_stats;</i></div><div><i><br></i></div><div><i>};</i></div></div><div><i><br></i></div><div> But it seems that the perl code is not getting executed, I do not have anything shown in my logger (console), </div>
<div> am I doing something wrong over here ?</div><div><br></div><div>Thank You</div><div>\amk<br><div> <br><br><div class="gmail_quote">On Sun, Jul 7, 2013 at 12:38 PM, David Precious <span dir="ltr"><<a href="mailto:davidp@preshweb.co.uk" target="_blank">davidp@preshweb.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sat, 6 Jul 2013 17:59:21 -0700<br>
Rik Brown <<a href="mailto:rik@rikbrown.co.uk">rik@rikbrown.co.uk</a>> wrote:<br>
<br>
> Of course you could also do:<br>
><br>
> {<br>
> results => \@sendArray<br>
> }<br>
><br>
> if you want your output to be a hash at the top level.<br>
><br>
> Hope this helps!<br>
<br>
</div>Rik's answer above is the course of action I'd typically recommend<br>
- because even if you just want the array for now, in future you may<br>
well decide you want to provide other information from that call, too<br>
(perhaps be able to return an error message as a key named 'error', or<br>
return the number of results found as a key named 'count', or return<br>
the average of all the values... etc) - so returning a hashref as Rik<br>
illustrates helps with future-proofing, as you could easily add more<br>
information to the response without breaking existing code.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
David Precious ("bigpresh") <<a href="mailto:davidp@preshweb.co.uk">davidp@preshweb.co.uk</a>><br>
<a href="http://www.preshweb.co.uk/" target="_blank">http://www.preshweb.co.uk/</a> <a href="http://www.preshweb.co.uk/twitter" target="_blank">www.preshweb.co.uk/twitter</a><br>
<a href="http://www.preshweb.co.uk/linkedin" target="_blank">www.preshweb.co.uk/linkedin</a> <a href="http://www.preshweb.co.uk/facebook" target="_blank">www.preshweb.co.uk/facebook</a><br>
<a href="http://www.preshweb.co.uk/cpan" target="_blank">www.preshweb.co.uk/cpan</a> <a href="http://www.preshweb.co.uk/github" target="_blank">www.preshweb.co.uk/github</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div></div>