#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246

    Modern::Perl vs Catalyst vs Dancer vs Mojolicious


    Hi Guys,

    I'm wanting to move my Perl coding forward and am currently reading Modern Perl http://onyxneon.com/books/modern_perl/

    I was wondering what your advice would be as to starting to use the Modern::Perl module and if so, which one as there is an ACME version?

    Or would you recommend a Perl framework and if so which one and why.

    Thanks,

    1DMF.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,262
    Rep Power
    1810
    I really appreciate the effort chromatic is making with his push for Modern Perl, but I haven't used his module.

    The main feature of the module that I've seen is it enforces the use of strict and warnings, which I agree should be on by default in perl. I think he'd like to give a little nudge to the developers of the perl 5.10 branch, and have them modernize the language in these ways; something I'd like to see as well.

    As to choosing between Catalyst and Dancer, I haven't. I've looked at them both with interest, but when I've wanted a big framework like that, I've used Rails. That's what they are emulating, and Rails has all the documentation, support, and modules.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    OH, then I'm not sure I want a framework.

    I've looked at RoR and ran away.

    It doesn't play nice with exisitng DB Schemas and I was at a loss how it all worked, having to run command line stuff to create scaffolding and creating DB tables with columns via command line.

    It was all AFAIC 'yuk!', I have MS SQL with Studio Manager, I run DB SChema from sun microsystems and that's how I want to manage my DB.

    RoR doesn't work that way and I don't want any framework that works like RoR.

    Catalyst seems to suggest from the small look I had that you can use your own prefered templating system and as I use the Template module anyway with my perl apps , it looked promising.

    I haven't investigated enough to really be able to make a fair oppinion.

    But if all Modern::Perl does is the same as use strict and warnings, well what's the point in that, I have both those pragmas in all my scripts already?

    I've started to develop all new perl apps in OOP, is it worth looking at any of this?

    Cheers,
    1DMF.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  6. #4
  7. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,262
    Rep Power
    1810
    Actually, Rails works well with existing DBs. The thing I generally don't like about these types of web frameworks is the use of ORMs. It's just another layer of abstraction that is supposed to simplify, but often feels like it gets in the way of efficient use of the database.

    Truthfully, they work fine most of the time, but it's easy to generate ugly queries with them, and can be difficult to understand how to get the results you want. It's sometimes easier to just write the SQL yourself.

    Catalyst uses DBIx::Class as its default ORM, I believe, but it's supposed to allow you to do things your own way and swap out ORMs and template types.

    As to preferring one framework over another, as I said, the big advantage for Rails is community support. Where a lot of perl coders may be curious about either Catalyst or Dancer, documentation and tutorials are sparse. On the other hand, there are many, many excellent training resources for Rails: videos, websites, books. That's what got my interest.

    ---

    As to Modern Perl, CPAN explains:

    Modern Perl programs use several modules to enable additional features of Perl and of the CPAN. Instead of copying and pasting all of these use lines, instead write only one:

    use Modern::Perl;

    This enables the strict and warnings pragmas, as well as all of the features available in Perl 5.10. It also enables C3 method resolution order as documented in perldoc mro and loads IO::File and IO::Handle so that you may call methods on filehandles. In the future, it may include additional core modules and pragmas.
    So, you get strict and warnings, object-oriented file handles, a few new methods such as 'say' and perhaps the switch statement, and a different method resolution priority when method names conflict.

    It's just a bit of a convenience module.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Thanks for the input.

    I've decided to concentrate on Catalyst.

    I've already managed to get the Debian tutorial VM running ,including an SSH terminal services session (Putty), FTP - FileZilla, the first 'Hello' app and my web browser all talking to it! - far further than RoR or Dancer.

    OK perhaps that's because I'm using the pre-configured VM, rather than trying straight away to bolt it onto Windows / IIS7 / MS SQL.

    I was also told by the rails google community that RoR should not be run on Fast-CGI, so I was kind of wasting my time as I want to eventually run all this on a Windows platform.

    But at least I now have a working environment that I can work my way through the CPAN Catalyst tutorial and hopefully get my head round the framework and go from there!

    Many thanks,
    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Hi,

    I'm already hitting a barrier in my head regarding the Catalyst ORM.

    I just want a simple mechanism to select the data I want (which I have already - a hand rolled SQL module), via SQL queries, which may include simple counts, sums, stored procedure executions, table or column aliasing, use of table views ..etc...

    How do I do this with the Catalyst ORM 'DBIC' ?

    I also find it interesting what Wiki says about the use of ORM
    Compared to traditional techniques of exchange between an object-oriented language and a relational database, ORM often reduces the amount of code that needs to be written.[2]

    Disadvantages of O/R mapping tools are in areas where proprietary, or database-specific techniques have been highly optimized. Most O/R mapping tools do not perform well during bulk deletions of data or joins[dubious discuss]. Stored procedures may have better performance, but are not portable.

    In addition, heavy reliance on ORM software has been pointed to as a major factor in producing poorly designed databases.[3]
    Do I need to throw away the DB Schema files in Catalyst and ignore DBIC and carry on with my own method of retrieving SQL data?

    When I start to develop my 'real' app should I not run the helper script for creating a model?

    If I still need to run the helper script for creating a model, how do I do that without it creating schema files and a tonne of model modules based on what it thinks are relationships in the data?

    Do I need to spend a lot of time manually editing and creating the correct DB Schema files?

    Also my application uses two MS SQL servers in separate parts of the country, they are not in the same domain and so I have to write code to switch between the servers and use 'lookup' hashes to programatically join data across them.

    How on earth would I do this with Catalyst and the DBIC ORM?

    Guidance on this is appreciated.

    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!

IMN logo majestic logo threadwatch logo seochat tools logo