Perl module dependency manager Carton installs dependencies into a subdirectory of the project directory, and expects perl to be run under carton exec to set the necessary environment variables to locate the modules. Flycheck runs plain perl, and consequently fails to find the correct modules, reporting an error for the missing module and masking any other problems.

How do I tell Flycheck where to look for these modules?

1 Answer 1


Place the following in a file .dir-locals.el in the root of the project:

  . ((eval
      . (let ((project-dir (expand-file-name
                            (locate-dominating-file default-directory
          (setq-local flycheck-perl-include-path
                      (list (concat project-dir "lib")
                            (concat project-dir "local/lib/perl5/"))))))))

This is a special case of question How can I set directory local variable in relative to .dir-locals.el file location?.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.