Tuesday 14 April 2009

Padre + Catalyst

For a while now, I've been contributing (or at least trying) to Padre - The Perl IDE. Although it still lacks some nice IDE features, it's really amazing to see how much has already been done in so little time. In fact, Padre releases are almost weekly, with Changelogs filled with active development and bug tracking. Szabgab++ managed to create an active and exciting community around the project, and I'm really glad to be a part of it.

One of Padre's cool features is plugins. Jq++, Alias++ and everyone else did an amazing job with the plugin API, so it's getting easier and easier to extend Padre's functionality. In fact, there are already over 20 plugins available on CPAN and many more to come. Recently, I created one myself, hoping it would improve the Padre experience and help developers of web applications, specially beginners: Padre::Plugin::Catalyst.

Installing the plugin should be fairly simple on the cpan shell

cpan> install Padre::Plugin::Catalyst


Of course, it has both Padre and Catalyst::Devel as dependencies. After installation, fire up Padre and go to the Plugins->Plugin Manager menu option.

The Catalyst plugin should show up. Select it and click on the "Enable" button so its status turns green (enabled), as shown in the image above.

That's it! The plugin and all its features can be accessed through its own menu at Plugins->Catalyst:


Let's browse through some of the options:

New Catalyst Application



This option will create a new Catalyst application on the specified folder. You can mark the "short names" checkbox to use "M", "V" and "C" folder names instead of the recommended "Model", "View" and "Controller" names. After clicking on the "OK" button, the plugin will create a skeleton program for you and ask if you want to open the created "Root.pm" controller so you can start programming right away.

Create New -> Model


This option lets you create a new model for your application. Here, you can specify your Model's name, type, and any additional parameters needed. "Type" is a list with all helper models available on your system, for you to choose from. It defaults to mst++'s DBIC::Schema (if available), as it's considered the ORM technology of choice for Catalyst.

Create New -> View


Similarly, this option will let you create a new View component for your application. "Type" defaults to the highly popular Template Toolkit helper, whenever available.

Create New -> Controller


With this option, you are able to quickly create a skeleton for any controllers your application may have. The default "Type" is no type at all, but, if you do use Controller helpers, you can also specify any additional parameters for it.

Start/Stop Web Server


At any point, should you want to test-drive your web application, you can click on this option to call the yourapp_server.pl script (where "yourapp" is the name of your Catalyst application, of course), a stand-alone development web server. All the output produced by the server will be displayed right on Padre's Output window (very useful for debugging), and it will ask if you want to open your web browser to actually view your application running.

Catalyst Online References

This option has quick shortcuts to some handy developer's information links available on the Internet:


That's about it :)

Future plans include letting the developer choose its favorite types, script updating features, and much more. If you want to help, you can checkout the current code from Padre's svn repository, or give me some feedback on any bugs or feature requests via Padre's Tickets or CPAN's RT.

Let me know what you think!

7 comments:

  1. Interesting - I was thinking about adding a kind of UI for InstantCRUD. So that programmers could choose some options and have a ready-made Catalyst application generated. Those options would be choosing the CRUDified tables and their columns, choosing the user table and columns for authentication etc. In short things that while vary between projects don't really count as 'programming'.

    ReplyDelete
  2. I am following Perl since 1998. Unlike some folks of little faith, i am still a strong believer in this language and use it daily, for Real Work and for personal stuff.

    I am also following the news around Pugs and Rakudo and all that. While i do believe that Perl 6 has a bright future, i find these news hard to read because of all the new jargon in it, many pieces of which dripped into Perl 5 news, too.

    One very common piece of this jargon is the usage of ++ after names of hackers. I've been trying to understand the meaning of this ++ notation for over a year, and now i give up.

    Pray tell me: What is the meaning of Szabgab++? I know who Gábor is, in fact i met him in person, but what is the meaning of the ++?

    This has nothing in particular to do with Padre or Catalyst; i just decided that now is the right time to ask this question. Please excuse me for its being off-topic. Thanks in advance.

    ReplyDelete
  3. @Amir : the trailing ++ is like in C/Perl/Java/etc.: bump the karma associated with the word (or expression if it's inside parentheses) by 1. A way to say "This is good" or "This deserves more credit".

    On IRC, there are some bots that keep track of the number of $x++ and $x-- that people said, and can be queried to determine the karma of someone or something. For example:

    <<<<<<<<<
    [rindolf] perlbot: karma perl
    [perlbot] Karma for perl: 291
    [rindolf] perlbot: karma php
    [perlbot] Karma for php: -172
    [rindolf] perlbot: top 5 karma
    [perlbot] The top 5 karma entries: C: 5367, moritz: 1964, pmichaud: 1291, fglock: 1137, pmurias: 1094
    [rindolf] Hi all, BTW.
    >>>>>>>>>

    A similar web jargon (derived from Debian mailing list) is +1 and -1 for "accept" or "reject".

    ReplyDelete
  4. [name]++ is just a way of publicly giving someone a pat on the back. A way to increment the karma associated with the person :)

    ReplyDelete
  5. @zby: I think this is a really nice idea! I'll definitely look into it for future releases of the Plugin, let me know if you want to help :)

    ------
    @Amir: If $name has an integer value, then $name++ would increment it. So its a short praise to the developer, whenever he/she does something nice (it's sometimes referred to as the person's "karma" :)

    (but hey, people already answered this before me, so (and as another example), rindolf++, Garrett++)

    ReplyDelete
  6. I am now deep in improving FormHandler (with the goal of basing next version of Instant on it) - so it'll take time. But I'll try to keep in touch with you - my email is zbigniew (at) lukasiak.name . Cheers.

    ReplyDelete
  7. Amir++ for asking what many don't know but don't dare to ask.

    ReplyDelete