« Hmm | Main | mod_perl DBD::Oracle and OCIEnvNlsCreate errors »

April 22, 2009

TextMate macro to create stub perl script

Every time I start writing a perl script it is always the same:

#!/usr/bin/env perl
use warnings;
use strict;

# put code here

exit(0);

I don't know why it took me so long to do this, but I finally got sick of typing that in every time I started a script and created a macro for TextMate so that all I have to do it type 'perl<tab>' and it does the rest.

The text is:

#!/usr/bin/env perl
use warnings;
use strict;

$0

exit(0);

Make sure the Scope Selector is blank so that it works in new documents. The '$0' marks where the cursor will be.

Posted by ed at April 22, 2009 3:57 PM

Comments

Nice. If there's one thing I hate it's repetitive shit.

Posted by: Nick at April 23, 2009 10:08 AM

Post a comment




Type the characters you see in the picture above.


Remember Me?