in reply to Re: tt2 with perl cgi and a csv file
in thread tt2 with perl cgi and a csv file

I looked at CGI::Application and Catalyst. I have rather been hoping to be all done inside of one or two weeks though. I guess I need to see a few more messy details before I am ready for them. This project should not get real big. I just need a way to edit the lines and a auto-create, to create a line for every new file dropped into archives, and that should be it. When it at last gets top heavy (like my own template system did before I started using tt2), I will look back into CGI::Application and Catalyst. Thanks!

Replies are listed 'Best First'.
Re^3: tt2 with perl cgi and a csv file
by Your Mother (Archbishop) on Mar 27, 2008 at 20:22 UTC

    I'm all for it but let me regale you with a tale of my false economy.

    I did a standalone CGI, DB driven site for myself with really some of the tightest, nicest code I've ever written. It was entirely similar to a straightforward CGI::Application or Catalyst app, using URI dispatching and method checking and such. Because it was somewhere around the 1,000th CGI I'd written, it was easy, it was clean, and it took only 3 days to write because I could lean on experience + CPAN for sessions and DB stuff.

    Then I realized I wanted RSS/Atom on it. Well, there's another half day coding. Then comments. Another day or two gone and the code is now not looking so clean. I realized I'd like admin editing to work differently and have queues for drafts and published pages and be searchable and have topics/tags and Ajax and email updates and better error reporting and self-validate XHTML and... Holy crap, that is gonna be a drag... Redid it in Catalyst.

    Extra tasks like those when done in Catalyst can often be as short as 10 new lines of code. Easier to read. Easier to test. Easier to maintain. Fewer chances you left some exploit accidentally. Plus more jobs for Cat devs. :)

      Its odd having more then one place to reply on a thread. Thanks for telling me what AoH is stiller, I should have thought of that. Well I am thinking about going the Catalyst route. It seems like overkill but I thought that about tt2 before I started making my own little template system. Does catalyst work well with tt2? It looks rather... big. Also it seems to talk about SQLite. Does it also work with mysql? I have mysql on my server for doing mail routing. Also if I do go the Catalyst route should I move the system to a DB? Does it have a prebuilt thing that does about what I am trying to do? I started this project with a mind to do a quick convert of my old mailer address book manager so I have not really looked into what is already made for this kind of thing. Thanks!

        I don't want to candy coat it. Catalyst has a learning curve, the docs are badly out of sync in a few places right now, and DBIx::Class, the ORM of choice, also has a learning curve, probably steeper. Then there are deployment issues. A CGI is a snap. Deploying a Cat app can be easy-ish to difficult depending on the host/env.

        That said, once you're acquainted with the stuff it's just amazing how much more productive it makes you. Factor of 10 just thinking back to big projects without it. In fact, I did a gig in Cat in about two weeks that took something like 4 months to do without it and it was missing *many* safety and UI features the Cat app had.

        One of the best things about Catalyst is it is, unlike Rails, agnostic about everything that plugs into it. You like YAML? Your config files can be in it. Or JSON, or XML, or init, or Apache style, or anything. You want plain DBI, CDBI, DBIC, Rose::DB? You have your pick. You have Oracle, MySQL, Postgres, SQLite? Bring it on. You want TT or HTML::Template, or Jemplate, or whatever! You've got it. The caveat there being: the Cat community leans pretty heavily toward TT and DBIx::Class. SQLite is used in a lot of examples for its simplicity and portability; it's great for testing too. Few folks are running applications with it.

        It's a terrific community (or several, TT and DBIC have good lists too) with at least a couple of wonderful monks on the mailing lists. It's not always easy to get going but there is help available and once you're immersed, it really just raises your game tremendously.

        Catalyst is very flexible. It defaults to using tt2 for a template system, but it will let you use others.

        Also it will let you move your data into any database system, or you can keep them in the csv-file. If you keep it in the csv-file you will still interface it as a database, using DBD::CSV. SQLite is often used while developing because it's lightweight and convenient, and the catalyst examples tend to use it. You can use any old database you want to.

        The Catalyst book and online examples will show you how to get your project done with very litle code, and with very much flexibility for further work.