October 10th, 2012, 05:35 AM
Modern::Perl vs Catalyst vs Dancer vs Mojolicious
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.
October 10th, 2012, 09:31 AM
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.
October 10th, 2012, 10:21 AM
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?
October 11th, 2012, 03:07 AM
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:
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.
October 11th, 2012, 08:36 AM
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!
October 12th, 2012, 05:26 AM
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
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.