Skip to content
jrockway edited this page Sep 13, 2010 · 19 revisions

Here’s what my Perl support looks like right now:

    (define-project-type perl (generic)
      (or (look-for "Makefile.PL") (look-for "Build.PL"))
      :relevant-files ("\\.pm$" "\\.t$" "\\.pl$" "\\.PL$")
      :is-mxdeclare-project (lambda (root)
                              (file-exists-p (concat root ".mxdeclare_project")))
      :main-file "Makefile.PL")

    (defun cperl-mxdeclare-project-p ()
      "Determine if this project should use MooseX::Declare class definitions."
      (ignore-errors
        (eproject-attribute :is-mxdeclare-project)))

I use the cperl-mxdelcare-project-p predicate in my auto-inserts to automatically generate the right code. (“use Moose” if it’s not MX::Declare, “class Foo” if it is.) Before eproject, I manually searched for the project root and the .mxdeclare_project file; now this is all handled for me. I could also write :is-mxdeclare-project t in a .eproject file, but I do it this way for compatibility with my other .emacs code.

Clone this wiki locally