Search code examples
perlsublimetext2sublimelinter

Add custom path to Perl libraries for SublimeLinter


I'm using Sublime Text 2 editor for Perl development and now I faced next problem. I have my project under:

/home/alex/workspace/

In this project I have libraries under:

/home/alex/workspace/lib/

While I'm editing file:

/home/alex/workspace/test.pl

and in this file I try to load library:

/home/alex/workspace/lib/myLib.pm

I have a code like this:

#!/usr/bin/perl
use myLib;

sublimelinter is not able to find this library because it is not in default @INC path. Is there any way to modify Perl's @INC for sublimelinter without changing my scripts source code?

I tried to use per-project settings for linter like this:

{
"folders":
[
    {
        "path": "/home/alex/workspace"
    }
],
"settings":
{
    "SublimeLinter":
    {
        "Perl" :
        {
            "lint_args":
            [
                "-I", "/home/alex/workspace/lib",
                "-c",
                "{filename}"
            ]
        }
    }
}
}

But this does not help.


Solution

  • These answers should be updated for sublime text 3

    Open Preferences-> Package Setting->SublimeLinter->Settings-User.

    Find this entry, and replace /path/to/my/project

      "linters": {
            "perl": {
                "include_dirs": ["/path/to/my/project"]
            }'