Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax applications with perl backend - how to?
    primarykey
    data
    text
    <p>There are already questions about the Perl+AJAX, like <a href="https://stackoverflow.com/q/824385/632407">here</a>, <a href="https://stackoverflow.com/q/1687032/632407">here</a> or <a href="https://stackoverflow.com/questions/1733815/how-do-i-use-ajax-with-jquery-in-perl">here</a> and several others. They're more than 2 years old and I was hoping for some new stuff. </p> <h3>The questions are:</h3> <ul> <li>What is the most preferred method today making AJAX apps with a Perl backend?</li> <li>Are there some <em>active</em> and commonly used Perl modules that help build AJAX based applications?</li> </ul> <p>Something, for the usual workflow:</p> <pre><code> if clicked this button (or changed this field.. etc), POST these data to the server, read the JSON answer, and update this/these DIV(s) in a DOM... etc. </code></pre> <p>This question is can be classified as vague, but I'm <strong>really lost</strong> and need help with this: what is the most common way making AJAX apps in the Perl world, TODAY.</p> <h3>Looking for a helper module that help me build the browser-side javascript.</h3> <p>I found these:</p> <ul> <li><a href="https://metacpan.org/pod/OpenThought" rel="nofollow noreferrer">https://metacpan.org/pod/OpenThought</a></li> <li><a href="https://metacpan.org/pod/HTML::AjaxTags" rel="nofollow noreferrer">https://metacpan.org/pod/HTML::AjaxTags</a></li> <li><a href="https://metacpan.org/pod/CGI::Ajax" rel="nofollow noreferrer">https://metacpan.org/pod/CGI::Ajax</a> (but this is CGI based and IMHO not the best for Plack world)</li> </ul> <p>These modules <em>have not been updated</em> for several years. Are they stable and <strong>in use</strong>? Or are they deprecated and is there some better way? (for the modern Perl technologies - like Plack).</p> <h3>UPDATE</h3> <p>As I read answers, I'm thinking that the main problem is probably in my English. I don't know how to express myself right.</p> <p>I know Perl. Maybe I'm not an expert, but I wrote several thousand lines of code. I know Dancer, and already write some apps in Mojo...::Lite. Know JSON{::XS} and I know how AJAX works.</p> <p>Now (for some reason) I prefer using Mason2, with Mason::Plugin::RouterSimple and several other CPAN modules and Moose. Catalyst, Jifty are too big for my needs.</p> <p>Back to the question:</p> <p>My favorite JS framework is jQuery, I'm using it in several projects for modal windows, or accordions, tabs etc.</p> <p><strong>BUT</strong></p> <p>My main problem is exactly in Sismetic's answer. I don't want to write JavaScript. Don't like it. (Don't know it very well, and hate every language where I must write something like: <code>var arr = new Array();</code> instead of <code>my @arr</code>) </p> <p>So, looking for a solution, how I can <strong>minimize</strong> (or in the ideal world - totally eliminate) the need of writing the JavaScript code. Don't want write into my templates</p> <pre><code>$('.clickableButton').click(function(e) { .... etc... etc.. )} </code></pre> <p>but something like:</p> <pre><code> $ajax-&gt;make_button( -onchange=&gt;$url, -updatedom=&gt;'#thisdiv", some_special_button_description_in_perl ); $tohead .= $ajax-&gt;gen_libs(); $tohtml .= $ajax-&gt;gen_html(); $jsdocready .= $ajax-&gt;gen_jsinitcode(); </code></pre> <p>An in my templates will output only <code>$tohead</code> in the head part (so include jQuery), <code>$tohtml</code> will come into body, and <code>$jsdocready</code> will come into the end of body as JavaScript init code.</p> <p>Offcourse, the above is an very stupid example, but hopefully shows what I mean. Simply: The ideal solution was (probably does not exists) is totally eliminate the need writing JavaScript, only Perl code what will generate the needed JS.</p> <p>Therefore I mentioned the above modules, especially <a href="https://metacpan.org/pod/OpenThought" rel="nofollow noreferrer">https://metacpan.org/pod/OpenThought</a>, because these really help minimize writing JavaScript. The problem is - these have not updated for 2 years. ;( And unfortunately - I don't know any others.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload