Tags: catalyst

me in B&W

Couple of Catalyst powered sites.

Even tho we haven't got the holy buzz of Rails, people seem to be putting up new Catalyst-powered sites all the time. I'll try to mention some as I hear of them in the future, here's a couple to get you started

www.discvrevolt.com
21:17 <bert_> it is for independent artists to be able to easily sell card at 
              their live shows, and fans use them to dl songs from our site 
              when they get home...
21:18 <bert_> site went from concept to production in 3 months...
21:18 <bert_> you guys here helped us through the rough part, none of us had 
               used catalyst before this...
21:18 <bert_> we really appreciate your help


Let's get dugg

This is a neat blog powered by a new Catalyst-based blog software called Typeface. Typeface is downloadable right now, so feel free to check it out.
me in B&amp;W

Dispatch by request method

I often find myself needing to make actions that should only be dispatched to by the POST method, or writing dispatch logic to distinguish between POST and GET in my various methods. It would be nice if the Catalyst dispatcher could handle this for me directly. However, we should probably support the whole HTTP spec, and adding those would pollute the attribute space pretty badly. Thus I suggest that we add a prefix, like do_POST or require_DELETE to the dispatch value. The other alternative is to add a method attribute, which would make the api look something like this

sub admin : Local Method('POST') {}

Obviously, it would have to match against specific methods first, then fall back on a generic handler without a specified method. Any other thoughts on the API?
me in B&amp;W

(no subject)

Iusethis is one of the more profiled Catalyst sites out there, and people have been asking me what modules I used to build this site. I figured that was worth doing a blog post about, so here goes:

Catalyst::Runtime
Obviously :)

HTML::TagCloud
For /tags , and more recently /user/$user/tags . I've submitted patches to this module so I could generate html the way arne wanted :-) These patches has been rolled into the cpan distro by acme++

Catalyst::Model::DBIC::Schema
During early development, I loaded the DBIC classes automatically, but as I started stabilize the schema,
I used the feature to generate static classes from the database.

Net::Trackback
We support trackbacks using this module. It was pretty easy to integrate into the Catalyst controller,
and later when I found out trackback is a spammer's wet dream, it was easy to add domain checking in the
action. We now do explicit whitelisting of domains, with a user interface to add your domain, if you want
to be linked on the app entry. I'm also planning on adding avatar support through this feature

DBIx::Class::DateTime::Epoch
I store all dates as long ints in the database, and use this module to automatically inflate them to
DateTime objects.

Catalyst::Plugin::Authentication / Store::DBIC / Credential::Password
To handle user authentication. The flexibility nothingmuch++ put into our second generation auth layer makes me very happy. If you do auth in your app, you need to use the Authentication plugins.

Collapse )
me in B&amp;W

Manager friendly benefits of Catalyst

22:52 < Peyomp> Is there somewhere that explains clearly, what benefits
Catalyst gives over straight CGI and TTthat is suitable for
management types?
22:55 < drPoggs> Peyomp: Yeah - go in, say Catalyst and rub your thighs
vigorously at your manager :)
22:56 < drPoggs> Peyomp: Then say CGI and look sad.
me in B&amp;W

Making a dynamic blog include?

<script type="text/javascript" src="http://osx.iusethis.com/app/include/iterm"></script>
<noscript><a href="http://osx.iusethis.com/app/iterm">Support iTerm on iusethis</a></noscript>
This is how a live iusethis count with a logo currently looks. However, I am unable to include that in any blogs I have tested so far. Any suggestions for better ways to make dynamic content that bloggers can include in their posts? For example, I'd like for them to be able to use this in a header for an app review, or to blog what apps you are using. The only thing that springs to mind is making dynamic images, but that seems like a very crude way to implement such a feature. I understand the security concerns here, but I'm still a little frusterated with the limitations.

Dear lazyweb, please help? *sigh*
me in B&amp;W

Serving filehandles with Catalyst

Serving a response in Catalyst is pretty easy. Usually, we either stuff a scalar into the response body, or just let the view take care of it like this:
    $c->res->body('dude, what's up?');
	 $c->forward($c->view); # Or just let RenderView handle it
				# As is the default.
However, sometimes this is not practical for your purpose. Maybe you need to serve a streaming mp3, or you have a big file that you don't want to load into memory all at once... Fixing this is just as easy, tho.
    my $fh=io('/tmp/bigfile');
    $c->res->body($fh);
and presto, Catalyst will serve the response from the filehandle. Of course you will have to tell catalyst how much data you expect $fh to contain since the headers are written before the response body.
$c->res->content_length(-s $file)
Would be a simple example of how to do that.
me in B&amp;W

Making the iusethis "did you know" function.

(This will be the first in a series where I show how I solved some of the issues in making http://osx.iusethis.com/) Iusethis uses a common layout style with one main pane, and a smaller right-hand sidebar. We've made it so it is easy to reuse these sidebar items by putting them in a /sidebar folder in our template directory. Then we can just do stuff like [% PROCESS sidebar/didyouknow.tt %], and presto, you have a box like the one you can see on SQLitemanager for instance. This box was implemented 100% in the TT view, so that it doesn't require anything from the controller. To pick a random number, I use the TT Math plugin like this:
 [%USE Math %]
 [%SET tip=Math.int(Math.rand(10))+1%]
This assigns a number from 1 to 10 to the TT tip variable. Now it's just a simple matter of using a TT switch:
[% SWITCH tip %]
[% CASE 1 %]
You need to floss more often
[% CASE 2 %]
Don't Panic 
[% CASE 3 %]
...
[% END %]
And that's it, really. Hope this comes in handy for someone :)