9 posts tagged “catalyst”
I will be giving a talk titled Catalyst & Chained: Bondage for better applications at the Orlando Perl Oasis.
Abstract:
Need
to build a web application and keep hearing about methods you aren't
quite sure of? Know Catalyst but don't feel you really "know" it. We
won't go into carnal knowledge, but we will explore the various
dispatch mechanisms to build robust and extensible web applications.
The primary focus is on Catalyst and the Chained dispatch method, and techniques for getting the most out of this strategy. Employing these techniques allow better extensibility and flexibility.
In this talk, we will cover:
- Benefits of chaining
- Basic chained paths
- Configuring chained paths
- Using controller base classes for unifying chains
- Troubleshooting chains gone wrong
- Exception handling
Knowledge of Catalyst is helpful, but not required. A basic understanding of Object Oriented principles, such as inheritance, will also be helpful.
Perl is a superb language and I'm quite fond of it. It has a powerful OO system with a moderately insane API into it, but Moose takes care of that.
Catalyst takes care of the migration from cgi-lib.pl and CGI.pm into the modern era of actual frameworks.
DBIx::Class is unrivaled in the realm of ORMs. The power of chained result sets and (albeit needing to be refactored) power of SQL::Abstract is second to none. It makes everything fantastically simple to build.
My rec indoor soccer team is shuffling players, and we try to keep several slots open for part-time players and we needed a simple way of managing the roster. There was a Japanese utility that one of the managers pointed out to me, and it seemed like a great fit. After a weekend of hacking, and at first building an overly complicated system, I came up with a roster app. Searching for a name yielded nothing, so it's called Roostermatic.
ROOOOOSTERMATIC. Come on, say it with me.
If you have any sort of a rec league/volunteer-based squad for team-play then go over there, use OpenID to login and you can then create a team and manage your upcoming games. It was a very quick application to write, and the UI took by far the longest time, so please send feedback.
I'm hoping to integrate it into some other apps, but for now it's a good game management app with an Atom feed for upcoming games.
On more technical notes, it's built-up using Catalyst::Controller::REST which means it is REST-based. It requires authentication for most things and I haven't hooked up a webservices auth method yet so it really only operates cleanly in the browser. If I get interest in an API (especially for adding games, since I figure a lot of people will use a scraper to inject games) then I'll get around to it.
It makes usage of Template Toolkit, and sadly not that much Moose. There just wasn't a lot of need for it since the biggest part was validation. That's where DBIx::Class came in so nicely, writing a conduit for Data::FormValidator and the schema classes is a piece of cake. I didn't use anything on CPAN because I have a crazy system that croaks on error with an object that can then be used to populate form stickiness. It's heavily dependent on my TT style and isn't very suited for general purpose consumption, but I'd be happy to share if folks are interested.
I'm using MySQL for the backend RDBMS. Our application stack currently has MySQL Replication going on and I rarely feel like futzing with Pg on an admin/architecture level so MySQL constantly wins that battle. I do prefer PostgreSQL in all other facets and earnestly hope that replication is someday as easy as it is in MySQL.
It's running on a rather complicated app stack that consists of nginx, varnish and external FastCGI. I've nearly given up completely on Apache and find the alternatives much better suited for modern deployments. I have another entry pending that describes the service layout which I hope everybody will find informative... but it's not ready yet, so hang tight.
My wife just returned from shopping and giddily approached me and asked, "How do you spell Catalyst?" After confirming the spelling, she pulls out a box and goes, "It's Catalyst... Cologne!"
I love her for a) knowing the project and b) identifying cologne at a discount store that shares the name and buying it for me.
I was very saddened to see a posting on SoccerTV.com that they're closing up shop after selling their assets. It's a very nice and easy way to just view what upcoming games are going to be on. I only get Fox Soccer Channel, so it isn't that big of a deal but some of my friends have other channels (Setanta, GolTV, etc).
So, I did some quick Christmas hacking, and with the help of Web::Scraper (thanks Miyagawa!) and a quick domain registration I have a new site launched.
Soccer fans enjoy, and let me know what other channels you want me to add in (and I'm adding in more leagues as well) because I want to have a really good single source for soccer lineups.
I Watch Soccer [http://www.iwatchsoccer.com]
Let me know if you encounter any problems. It is running on a pretty limited host, but it is going to be moving to a beefier server soon.
(and yes, there are ads. I do have to pay my server bills... I just want to find the right balance between number of ads and content... feedback welcome)
With the Catalyst Advent calendar season coming up, and my recent plays with Catalyst::Action::REST, the natural course of action is to write an advent article.
Which then turned into a thread discussing the merits and availability of XmlHttpRequest methods as REST verbs. In more plain terms, finding out what browsers support the W3C specification for XmlHttpRequest and what browsers suck.
I created a very simple test case that simply creates an XHR object, and then 5 buttons for GET, POST, PUT, DELETE and HEAD. It submits to a URI with a REST webservice that supports the full vocabulary (although POST and PUT are aliased to the same actions).
Firefox (Version 2.0.0.8)
Firefox supports all methods tested just fine. It handles the response status code as expected, and seems to be fully compliant with the spec. Or at least however much one can prove this in 5 minutes of testing.
A++++ WILL REST WITH AGAIN!
Internet Explorer 6
Internet Explorer actually worked. I couldn't believe it. When I saw the PUT and DELETE requests come in I just about fell over. Now, before I award IE6 a passing grade I have to disclose that a friend tested it. I do think he's trustworthy, but I can never tell. He may just be trying to fake everybody out here, because who expects IE6 to do the right thing?
IE7
Fail, just like I expected. Just kidding. It worked. Damnit. I suppose if IE6 passes, IE7 would to. IE7 is a better browser by far, but still has a long ways to go.
Konqueror (3.5.6)
Fail. I'm disappointed by this one. I would have liked this one to pass. Instead, it only sends GET and POST. If you send with a PUT, it actually sends a GET. The server sends a 304 response and it reports the returned status code as 200. I hope that this gets fixed soon, or maybe it already is but I don't want to muck with upgrading KDE to 3.5.8 just to test.
Safari (v2)
Fail. Unsurprisingly just like Konqueror. The difference: Safari is a product put out by Apple. Think Different my ass. The next time I hear someone say "it just works" I am so responding with, "As long as it isn't a PUT request via XmlHttpRequest you fanboy!". Apple ftl.
Safari 3/WebKit
Pass, fully works. I didn't want to write that. Stupid Apple.
They finally upload FLOSS Weekly 20!
Hear me try not to insult Ruby on Rails, say good things about Catalyst and chat with Randal and Leo.
This last weekend (August 18th) I loaded the family up into the car, and we headed north across the border to descend upon Canada. After we duped the border guards into letting us into the country, we got checked in and I headed over to the Sophos offices, which nicely host the Vancouver.pm meetings.
My talk was aimed to be a quick (and moderately intense) overview of Catalyst. Sort of a flash point presentation. I've experimented with this type of presentation and I'm growing more fond of it, but I find it somewhat unnatural for my personality. I picked up the method from an ex-prosecuting attorney, who never lost a trial case. It's basically a tempo-based presentation where you go a couple beats of "filler" then have a powerful point.
I think in that regard, I didn't do so well -- but it was my first Catalyst presentation and my first "live" presentation attempting this method so it was fun anyway. There was a small turnout of (I think) 8 people, and while I was hoping for more I don't think the small turnout was a result of me being the speaker. I blame konobi.
I went over CatPaste, a simple POE-enabled paste bot that sends out notifications (works with Infobot-DBIC!). It's a fun, light weight application that doesn't have a complicated schema set nor does it have any nasty templates. It really just is 2 templates, one schema class and a few chained actions. It works as a demo app very well, although the little voice in my head wants to show something more impressive it is important to keep things limited.
You can get the source to CatPaste at http://dev.catalystframework.org/repos/Catalyst/trunk/examples/CatPaste
It ties in well to Infobot-DBIC, which uses POE IKC to do broadcast notifications: http://dev.catalystframework.org/repos/bast/trunk/Infobot-DBIC/
Met some great folks up in Vancouver, though - Alex, Stas and Todd (who I shall not forgive for not joining us for beers... choosing family over me, such audacity!) and the other attendees, thanks! Thanks to konobi (Scott) and Chris for organizing the whole thing.
Overview
At my job, we've just about finished work on the next segment of our Catalyst-based application. It required the implementation of a JobQueue system, and after careful consideration we narrowed down our choices.
Why TheSchwartz?
Aside from the fun statements that are made while working it into every day business conversation, it had a few things that really stood out over the competition. What competition, you say? Well, we really didn't have many options. Our choices for a reliable jobqueue (reliable meaning it handles failure conditions internally, and can guarantee success or failure) were really TheSchwartz, Catalyst::Engine::JobQueue or a home grown solution. TheSchwartz was really the only choice.
Getting it running
Setup was actually very simple. Aside from the hidden doc directory containing the schema, it was all laid out in a sane fashion. We configured one of our higher powered slaves to be the jobqueue database, and created the InnoDB tables. After that, configuring the test cases to use our DB and we were in business. Things couldn't have gone easier, really. Well, maybe if there was more Pod available but I'm not complaining one bit, considering how well it works.
Building Job Producers
Obviously, the worker machines are going to have a variety (nigh, a plethora) of tasks as time goes on. Building a variety of worker classes to dispatch the various commands grows tiring. This is where the ingenuity of one of our developers came into play and Object::Recorder was born. What this module allows us to do is have object-level continuations. This allows us to have a simple model class that uses Object::Recorder to insert jobs into the queue. The worker threads are simple Object::Recorder::Player objects that replay the serialized method calls (including construction). This means that we can modify our JobProducer and underlying worker code without ever having to touch TheSchwartz workers. Everything Just Works. Mostly, but that's what the community and RT is for.
Today I just pushed a new package to CPAN that introduces a "Graphics" helper. The general idea of the package is to install into any Catalyst application a batch of ready-made images that are useful. The only thing it currently has is an AJAX activity indicator, but I'm currently seeking other images to include.
If you have any ideas for new images to be included in this package, please let me know! I'm "jshirley" on IRC, or you can comment here and my email is always open.
Keep an eye out for some screencasts, coming soon!