twinkle twinkle catalyst

I'm developing under Catalyst and am using the Catalyst test server that is running on my local machine and is reloading every time I'm saving changes to the source tree. This is a cool feature, but I have to wait in front of the browser until the application is loaded full and can answer http requests; if I hit F5 in the browser before it is up and running I get a connection refused error and have to hit it again.

Finally I got tired of that and wrote this little hack that shows a load indicator on my ubuntu desktop. The thing is very primitive. While Catalyst app is loading, it blinks yellow. If it has loaded ok, it shows green light for a couple of seconds and then disappears. If there was a failure (syntax failure in my case most of the time), it shows red light which doesn't go away until the problem is fixed.

I'm coding on the project with the other people, and not all of them are using the blinker,so the module is not turned on by default. In I have it like this:

if ( $ENV{BLINKER} ) { 
   require Catalyst::Blinker;


Catalyst::ScriptRunner->run('MyApp', 'Server');

But if you _do_ want it on by default, you could do this instead:

use Catalyst::Blinker;

In both cases, the module recognizes $ENV{BLINKER} and parses the passed options (see below), f.ex.

$ export BLINKER=x=1900

( because by default if blinks on the top right corner of the desktop, and I use the line above to position in my first monitor, not the second).

So it twinkles :P

Leave a comment

About Dmitry Karasik

user-pic I blog about Perl.