Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello there Monks

I know a bit of Perl, but I have no idea how REST APIs work, very basic idea of how a web server works, very basic HTML. Plan is to learn a Web Framework...But I don't know if I should go for Dancer2 or Mojolicious....I've tried the tutorials on their portals, but I keep getting stumped beyond a certain point. So what's the right way to go about learning, kindly enlighten me.

Replies are listed 'Best First'.
Re: Dancer2 or Mojolicious???
by hippo (Archbishop) on Jun 23, 2021 at 21:14 UTC

    Since you say you have tried the tutorials for them and keep getting stumped perhaps Dancer2 and Mojolicious are not ideal for you? There is no need to restrict yourself to a binary choice between these two web frameworks when there are so many more to choose from (and that list is far from exhaustive too).


    🦛

Re: Dancer2 or Mojolicious???
by davebaker (Pilgrim) on Jun 23, 2021 at 22:28 UTC

    Pepper might be a fun way to get started in the framework direction -- the documentation is very good, and the idea seems to be to enable the user to get something useful up and running quickly, and to be a confidence-builder.

    Quoting from the documentation:

    "This quick-start kit is designed for new users to easily experiment and learn about Perl and for seasoned users to quickly stand up simple web services. This is not a framework. This is a quick-start kit meant to simplify learning and small projects. The goal is for you to fall in love with Perl and continue your journey on to Mojo, Dancer2, AnyEvent, Rex, PDL, POE, and all other the many terrific Perl libraries (more than I can list here). This is a great community of builders, and there is so much to discover at https://metacpan.org and https://perldoc.perl.org/"

Re: Dancer2 or Mojolicious???
by NERDVANA (Priest) on Jun 23, 2021 at 23:58 UTC
    The best thing you can do would seem to be a serious in-depth study of the basics of HTTP. Web frameworks are designed to solve the problems of working with HTTP and web browsers, and advanced web frameworks like Dancer and Mojo are designed to solve the larger problems of building maintainable applications on top of these technologies. If you don’t fully understand the technology itself, the solutions to its problems won’t make much sense.

    So that’s my advice. Start with a book or a college course or online tutorial series about HTTP before getting into a framework of any language. Know what is possible for HTTP requests and what things you can send in a HTTP response, and why you might want to send them. Don’t stop until you can connect to port 80 with Telnet and type in a HTTP requests by hand.

    Then, when you go to learn a framework, all of it will make sense.

        Discipulus:

        Oh! That's a nice library. I may have to start on a library of my own, it's such a nice idea. I'm noting it here instead of in your library, because I didn't want to litter your library with non-useful nodes.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

      Giving credit where credit is due. Best advice I've seen in a long time.
Re: Dancer2 or Mojolicious???
by karlgoethebier (Abbot) on Jun 24, 2021 at 12:56 UTC

    Learn some HTML and CSS first. See here for some good templates. Build a static website. Install a webserver on your box and learn how to configure it that you can access your website on http://localhost.

    «The Crux of the Biscuit is the Apostrophe»

      > Learn some HTML and CSS first.
      Oh how much more sane, rational, and slowed would the world of web applications be if everyone followed this advice. If I could, I'd vote for this comment 1_000 more times.
Re: Dancer2 or Mojolicious???
by Anonymous Monk on Jun 24, 2021 at 14:24 UTC

    Holy Cow!!

    All of you are right...I was getting flummoxed because I didn't know the head from the body of HTML (pun intended) and that is one of my problems.

    Thank you for sharing such fantastic resources and links...because my problem was I was going for sentence construction without understanding the grammar!! You all are amazing dudes of tech. And yes, I knew that only PerlMonks can give me sound, high quality technical advice and just grep and map out the bullshit.

    The language is as awesome as the monks. Nobody disseminates info with such clarity as you guys.

Re: Dancer2 or Mojolicious???
by perlfan (Parson) on Jun 30, 2021 at 16:37 UTC
    To add to the great suggestion of learning "HTML", etc and the other great advice below from AnonymousMonk (but ignoring that wretch, AnonymousMonk); I'd like to throw out a module I've been following with some interest lately - CGI::Tiny. If only those new to the arts could go through the progression of static HTML -> modern PSGI like many of us did starting in the early 90s (or before).

    With the CGI approach, you are instantly also able to take advantage of a super cheap shared web hosting environment very easily, since even the most basic plans out there take advantage of /cgi-bin and give you at least 1 database. It's the perfect environment for budding web application programmers - and where Perl still clearly rules. It gets pretty blurry once you get into hosted application clouds and all that weird modern serverless crap. Anyway, check out CGI::Tiny once you do learn HTML better.

Re: Dancer2 or Mojolicious???
by Anonymous Monk on Jun 24, 2021 at 01:44 UTC

    Both of these frameworks are excellent and have been used to deploy many production web sites. But, from reading your initial post, I think that you should first spend a few days educating yourself. Learn about "REST APIs" and so on. Try to put your finger on exactly why you're, as you say, "getting stumped." Please feel free to ask more-directed questions right here – you're sure to immediately get a good answer.

    Also, take full advantage of sites like "github.com" and "sourceforge.com." There you will find the entire source code complete production web sites that have been freely contributed. You can retrieve one of these, or simply examine the source-code right on the site. You might even find an already-built site that is "fairly close" to what you're trying to build – such that you can "kit-bash" it to become exactly what you need without starting from scratch.

    A reply falls below the community's threshold of quality. You may see it by logging in.