Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

To Framework or not to Framework

by Bod (Friar)
on Nov 23, 2020 at 17:54 UTC ( #11124069=perlquestion: print w/replies, xml ) Need Help??

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

Despite regularly visiting The Monastery in the past, especially when the Great God Google has pointed me this way, in the last week since I created an account I have learnt a great such thing is the existence of frameworks for building websites. Until yesterday this was something that sat on the 'one day' pile - but now I have to build a new website so I am seeking help in deciding whether to use a framework or whether to do it in a similar way to I've previously done it but with use strict; firmly in every script!

My partner has been dabbling with artwork for some months and wants somewhere to showcase her work and to be able to take commissions and make sales of prints.

Here is an example if you are interested

So...the website will only be maintained by me thus ensuring that others can maintain the code is not a consideration. Functionally it is not too complex with a few database tables and a very basic CMS so Joolz (my partner) can upload images of artwork and change their descriptions, etc. There will be some image manipulation (probably using GD::Image) to resize thumbnails so they cannot be usefully copied and to add a watermark to larger images but that would be the same however the rest of the site is implememnted (wouldn't it?)

Previous websites I have created have a standard library I have written to deal with form processing, image uploads, logging etc. They then have site specific subroutines for the boilerplate code common to multiple pages and to deal with database connections. All of this standard code is in *.pl files that are brought in with a require statement.

I would love your input of whether it would be beneficial to go through the (steep?) learning curve of implementing this new site with a framework or whether it would be preferable to use the boilerplate methodology that I am used to albeit using *.pm modules for the common parts and bringing them in with a use statement. I feel that I do not know enough about the advantages and potential pitfalls of adopting a framework to be able to make a decision.

I'm not asking for you to try and make a decision for me...but please...give me some pointers and shine a light into the dark corners where frameworks and other design considerations tend to lurk.

Replies are listed 'Best First'.
Re: To Framework or not to Framework
by tobyink (Canon) on Nov 23, 2020 at 22:28 UTC

    Without wanting to rain on your parade, I think you should give a serious look to hosted ecommerce solutions like Shopify, Redbubble, and Etsy. Any of them should give you all the features you want and you'd be up and running in a few hours rather than a few weeks or months, plus you'll be able to take online payments with reasonable certainty that they'll be secure (and a well-insured corporation to blame if they're not).

    Not saying you ought to go that way, just that it would be a bad idea to not at least investigate those.

      Thanks for the suggestion tobyink - I'm aware of Shopify as a business that I mentor uses it extensively for the eCommerce side of their operations. The main reason for not going down this route is this website will be more of a portfolio with sales forming just a small part.

      We did think of using WordPress as Joolz has some knowledge of this but she is not confident enough with it and doesn't really have the time and inclination. I was planning to get a basic site up and running in the next 4 days or so and improve from there.

Re: To Framework or not to Framework
by 1nickt (Abbot) on Nov 23, 2020 at 19:38 UTC

    Your code, your choice :-) Most people use frameworks because you then can spend time developing your app instead of a framework. Take a look at Yancy, the CMS for Mojo.

    Hope this helps!

    The way forward always starts with a minimal test.

      Your code, your choice :-)

      Yes indeed - and the purpose of the post is to help me make that choice :)

      Currently I'm unsure what help a framework would actually provide as, surely, all the boilerplate HTML, CSS, Javascript, etc still has to do coded by hand. I totally get that a framework helps with compatibility with other developers.

      I'm very much thinking that I'll try a framework for this project and then I will be able to form an informed opinion...

Re: To Framework or not to Framework
by choroba (Archbishop) on Nov 23, 2020 at 20:05 UTC
    > the website will only be maintained by me

    Do you know what a bus factor is?

    This is a good opportunity to learn something new. Pick a framework and create the site, ask here if you have questions. You'll start seeing the advantages pretty soon.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      This is a good opportunity to learn something new.

      That seems like a perfect reason to try out a framework :)

      It seems sensible to use whatever is installed on the shared hosting I use...except there isn't one! I have gone through this list and the only one listed there that is installed is Moose which is not what I am wanting.

      Because several monks have mentioned it, and 1nickt talked about Yancy, I am thinking that Mojolicious would be a sensible choice. But the documentation says " requirements besides Perl 5.26.0 (versions as old as 5.16.0 can be used too, but may require additional CPAN modules to be installed)"

      The shared hosting has v5.16 installed and I cannot directly install modules from CPAN because the compilers are turned off to shared hosting users. I have to contact support and then it's a lottery whether I get someone who installs the module or who says they are unable to. If there is going to need to be many modules installed before I can run Mojolicious under v5.16 then it could be a long time before I even get to write a line of code :(

      The plan was to have the first version up and running by the weekend - four days away...
      I knew it was going to be a steep learning curve but didn't expect the slope to be this steep, this soon!

        I cannot directly install modules from CPAN because the compilers are turned off to shared hosting users.

        You can directly install Pure-Perl modules from CPAN as those don't require any separate compilers.

        If you are really stuck and need an XS module you could always cross-compile as a last resort. However, in your shoes I would break the shackles at this point and move off shared hosting and onto a VM. Your shared hosting will probably limit the scope of any persistent framework/middleware anyway.

        I have gone through this list

        That list contains things which aren't web frameworks and is pretty far from exhaustive. Earlier this year I submitted this quest response which is far more extensive (and even then I left quite a few out).


        Can you not do the development on your local system in parallel with fighting the module install battle on the hosting system? That at least lets you know what module dependencies there may be.

        Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

      Do you know what a bus factor is?

      I am well aware of the bus factor. However, I would hope that should I befall this fate, my partner Joolz's primary concern will not be the continued development of her website 😊

      Having said that, do you have any input to help me choose a framework? Are they very similar or is it a case of nailing one's flag to a framework?

Re: To Framework or not to Framework
by bliako (Prior) on Nov 24, 2020 at 00:59 UTC

    Framework you should.

    Acquiring IT skills was, for me, the best way to declare that I am now holding the equivalent of ploughing the earth, sowing the seed, attending the seedlings, killing the weedlings and finally chopping the head of the wheat in one, compact and impressable package appreciated by non-technical people and it could, at the time, fit in one CD. Alas, dry season.

    Seriously, I have good experience with Mojolicious and DBIx::Class which is the SQL equivalent. And I had good advice for both of them from Monks here. You haven't mentioned DBs yet but it will be needed and you better prepare for that too. A house of bricks always wins when everything around tumbles down.

    bw, bliako

      Framework you should.

      And I think I am convinced that Framework I shall :)

      You haven't mentioned DBs yet but it will be needed...

      This is far from the only site I am running that has a DB supporting it. The core part of the ERD is written out and would have been built this evening had I not been reading up about Mojolicious instead. Our business booking site is built in Perl and utilises the DBI::mysql module although on the backend is actually a MariaDB. Here if you are interested.

      Because of the difficulty getting Mojolicious installed and set up on the shared hosting plus the steep learning curve to get it working and the proximity now to Christmas, I will be building an MVP site without a framework and then create a testing subdomain onto which I will implement a framework driven site using basically the same web code, just delivered in a different way.

        You don't need the extra hassle of managing a host without Linux OS and a shell to it (sorry I sound strong-minded but this is my experience - I dealt with "my host does not allow me" problems for as long as the host was for free - and thank them for that). There are lots of hosting sites with 5euros per month (OK performance, for me at least), forget cpanel and web-management. ssh to your site, ftp your site into it, cpanm all the packages you need, set-up nginx or apache as your web-server, install any database you need and go. Fair enough it needs some skills but invest in the skills now if you feel comfortable with these kind of skills.

        and the proximity now to Christmas

        Christmas is cancelled, let's hope only for this year

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11124069]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2021-01-18 02:18 GMT
Find Nodes?
    Voting Booth?