Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
The files I had were under /public/javascripts. They just don't show up that way in the routes. As far as getting things over a browser was concerned, the file was transferred as expected. Dancer's test framework was the problem.

There is no explicit route associated with stuff in /public. Rather, when Dancer finds no route matching a given request, it tries to find a file in /public. If there is still no match there, then 404. This still serves files in /public via send_file though, unlike regular template rendering, so you'd still get a filehandle and Dancer::Test would still be useless. (Fortunately there is little reason to test that Dancer's static file management works. That's already been tested, in Dancer's own test suite.)

I'm doing this as part of a comparison with Mojolicious for a possible future app at $work. Given that we will want tight unit testing, and that Mojo's test framework seems much more sophisticated, I'm leaning that way.

I can't offer any honest opinion on Dancer vs. Mojo, because I haven't tried Mojo at all. (I dislike their philosophy of never reusing the CPAN, reinventing everything by themselves, and keeping it all inside a monolithic distribution so that no one can reuse it either. I have no opinion on the technical merits of Mojo.)

Regarding unit testing of web apps, I'm not a fan of unit-testing them from request to rendered response because any change in the template for instance is likely to break your tests, and large pages with a lot of information are a pain to test against. I'd rather test separately that the values I'm passing to the template are what I expect, and then that the template renders correctly when passed certain values. This can be done with regular unit testing, like any module. Automated end-to-end testing of web apps, outside of Selenium and similar technologies, doesn't really work in my relatively limited experience.

In reply to Re^3: Dancer bugs? send_file(), content type, and response_content_is() by pokki
in thread Dancer bugs? send_file(), content type, and response_content_is() by hardburn

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [shmem]: unbelievable success!

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (5)
    As of 2018-04-20 22:37 GMT
    Find Nodes?
      Voting Booth?