http://qs1969.pair.com?node_id=1172391


in reply to jQuery issue with Dancer2

I’m pretty handy with jQuery but it’s hard to see what’s going on or how to test what you’re doing so I’m sorry I have no help, just a rude question. :P

I have had an arm’s length distaste for Dancer since its debut—not knowing it well enough to say while also not liking anything I do learn about it—but is that really how URLs are handled? With hard-wired, string concatenation? Is there nothing like Catalyst’s uri_for(), uri_for_action(), or uri_with()?

Replies are listed 'Best First'.
Re^2: jQuery issue with Dancer2 (Dancer, URLs)
by tye (Sage) on Sep 23, 2016 at 05:53 UTC

    I'm no Dancer expert and I only have limited experience with using it. But that was still long enough for me to experience ETOOMUCHMAGIC from Dancer. Since then I have repeatedly seen evidence of more of that. I also see Dancer/2 suffering more from "framework disease" than Mojo does. Framework disease is where there is much rejoicing about how you can build a whole functioning system with just 1 trivial line of code. This then leads to major spelunking required to detangle all of the magic that was hidden in order to make all of those things dance with such little specified. The spelunking need can come up any time you want to do something even a little different than the default way.

    But then, the many things I built didn't even use Mojo. They just used Plack.

    As for building URLs with concatenation, I've just come to expect such stupidity from all web frameworks. Before I had experience, I expected building URLs properly would be something built directly into JavaScript. Then I expected it to be someplace obvious in jQuery. Then I expected Mason to handle such things. But I almost never find tools for doing that in such places. And I have never found code written by others and using such tools that builds URLs other than by concatenation, and only rarely is any escaping done before concatenation.

    - tye        

Re^2: jQuery issue with Dancer2
by stevieb (Canon) on Sep 23, 2016 at 00:31 UTC

    Thanks Your Mother, no rudeness spotted :)

    The Dancer part doesn't really matter, as I know that I'm receiving what I expect from the Perl Dancer part. It's how I'm handling the JS. In the get_aux() js call, when I alert() I get the expected result (from Perl). But in the creation of the button (the call that calls the get_aux() in the function above it in my OP), the alert() states undefined.

    I'm reading up on use of 'callbacks' et-al right now.

    What *is* rude, is me looking for JS help on Perlmonks ;)

      Oh, I love the occasional JS question, especially jQuery. I have said before, I really think it touches the same sweet spot Perl does in terseness + expressiveness. If you have runnable code somewhere (github gist?) I would probably play with it tomorrow.