Archive for the ‘Dancer’ Category

Yesterday, I released a YADP (Yet Another Dancer Plugin). It’s called Dancer::Plugin::Auth::Basic, and it adds support for basic HTTP authentication in Dancer apps. It’s a side effect of my work on a project that needed a simple access restriction mechanism — I thought it would be nice to have a HTTP authentication solution for Dancer which is easy to use and universal (meaning it does not rely on Plack or .htaccess/htpasswd files).

Here’s a simple usage example — a fragment of Dancer configuration which restricts access to a specific path (/restricted):

And that’s it. If you’d like to try the plugin in your app, it’s up on CPAN and on Github.

This plugin also happens to be the first CPAN module that I’ve built using Module::Build, instead of the rusty ExtUtils::MakeMaker. I’ve had no problems switching, the only thing that was a bit troublesome was creating a README.pod file (which is a good thing to have if you’re publishing your module on Github), but I managed to do that eventually.

Would you like to integrate Sass into your web application using Plack::Middleware::File::Sass, but you have difficulty getting it to work, or your application is not running on Plack?

We’re introducing the great Dancer::Plugin::Preprocess::Sass, which allows you to use Sass files in your Dancer application, and have them converted into CSS ON-THE-FLY! What’s more, the generated CSS files can then be AUTOMATICALLY saved and served as static files, saving you CPU cycles AND money!

CALL the number on your screen and ORDER YOURS TODAY FOR JUST $29.99!

CALL NOW and you’ll get 10 EXAMPLE SASS FILES that you can use in your application ABSOLUTELY FREE!

Ok, but seriously, the plugin is available on CPAN and on GitHub. And it’s not $29.99, it’s free.

I have just released a new version of Dancer::Plugin::DebugToolbar, the debugging toolbar for Dancer web applications. This version introduces a new screen which displays the templates rendered by the application and lets you inspect the data passed to them. Here’s an example of this screen:

This release also introduces a few performance improvements and fixes a couple minor bugs.

The plugin generates directory indexes for selected directories on the server, allowing the users to browse through those directories and download files. It basically does the same that Apache’s mod_autoindex and Plack::App::Directory do, but it has the advantage of being integrated into the Dancer application and not depending upon how the application is deployed.

An obligatory screenshot:

I’ve put the plugin up on GitHub, and will relase it on CPAN shortly (after I polish the code a little bit).

This weekend we’re having pretty nice weather here in Warsaw, so what better way to spend your day other than to stay indoors and hack Perl? I’m here with a new version of the debugging toolbar plugin for the Dancer web framework.

A new feature introduced in this version is basic database tracking functionality. The information window can now show the DBI trace data, and display (some of) the SQL queries sent to the database. Here’s a screenshot of that:

I’ve also made significant changes in the basic structure of the code, and rewrote some of it from scratch. In the first release, the HTML code used to inspect the data structures was generated by Perl, which wasn’t especially elegant. Now, pretty much all presentation-related stuff happens in JavaScript, and the Perl code is only responsible for providing the data structures to display.

In the future, this might even allow me to quickly adapt the plugin to other frameworks/languages.

As you might remember, I recently got interested in Dancer, the fabulous micro web framework for Perl. That interest led me to rewrite my website to Dancer, but that wasn’t enough — I found the framework really fun and wanted to play with it a bit more. So I started a small project to develop a plugin that adds a debugging toolbar to Dancer web applications.

I have now made the plugin available on GitHub, and I will be releasing it on CPAN shortly. It’s still in an early stage of development — at this point, it only allows you to inspect your application’s routes and basic data structures. I hope to eventually turn it into a decent development tool, which would also be easy to use to help new Dancer users get familiar with the framework.

Here’s a screenshot of the toolbar displayed at the top of the browser viewport:

And this is how the data inspection window looks:

As usual, I’m looking forward to feedback, especially from you fellow dancers out there.

Notice anything different about my site? No? Good, this means that the transition went smooth. I rewrote the engine that my website runs on from Symfony to Perl Dancer.

You might remember that I introduced the Symfony-based engine less than six months ago, so why the switch? Well, back when I launched it, I kind of felt that it might not last very long — mostly because Symfony was just a better-than-nothing choice. For years, my website was running on an ugly framework-wannabe solution that I developed myself. By the way, if you ever get the same idea, consider this advice:

By the time I finally decided to rebuild it, Symfony just happened to be around — I had a Symfony project coming up and thought it might be good to first get familiar with the framework on a smaller task. I started working on the rewrite, and I quickly got the feeling that Symfony is just too big for the purpose of running a small website like this — I only needed a tiny subset of its numerous features. All in all, it felt way too heavy. But, I really wanted to replace the old engine, so I still went with it.

As for Dancer, I first heard of it about a year ago and I knew I was going to give it a try at some point. Why? Two reasons:

It’s a micro framework, which is much better suited for simple sites than a full-blown MVC framework

So, two weekends of enjoyable hacking, and here it is — my website running on Perl. More precisely, it’s a Perl/PHP hybrid, as the blog is still powered by WordPress. But, the blog engine is feeding its output to the Dancer application, so everything you see is processed by Perl.