Quick textmate tip for Perlers

Using Textmate for Perl programming? As you probably know, the Perl bundle supports validating your perl syntax with a quick shortcut. However, I picked up a quick tip from the “Javascript Tools” bundle. If you rebind the command as ⌘-S, TextMate will automatically check your syntax every time you save a Perl file. In case you need help doing this:

In the menu Go to Bundles -> Bundle Editor -> Show Bundle Editor

Open the Perl Bundle, Click ‘Validate syntax’, and from there you can easily rebind the key as shown below.

Bundle Editor
Uploaded with plasq‘s Skitch!

3 comments

  1. Pedro Melo says:

    I wonder if we could check, tidy and save with a single ⌘S… :)

  2. Danny Woods says:

    Nice tip.

    If you ever use Emacs, you can do the same thing with an ‘after-save-hook’, i.e.:

    (defun perl-syntax-check()
    (unless (file-remote-p (buffer-file-name))
    (if (string-match “\\.pl$” (buffer-file-name))
    (compile (format “perl -c \”%s\”" (buffer-file-name))))))

    (setq
    compilation-window-height 10
    compilation-scroll-output t)

    (setq after-save-hook ‘perl-syntax-check)

    …and stuffing those lines in your ~/.emacs file. Not quite as simple as TextMate, though.

  3. If you use emacs, “M-x flymake” will syntax-check whenever emacs is idle, and will underline areas of your code that contain syntax errors. Very convenient.

Post a comment

Copyright © marcus ramberg
nordaaker

Built on Notes Blog Core
Powered by WordPress