diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index e97b4169..e570484c 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -23,7 +23,7 @@ endfunction "returns " "{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} -function! syntastic#util#ParseMagicNumber() +function! syntastic#util#ParseShebang() for lnum in range(1,5) let line = getline(lnum) @@ -33,6 +33,8 @@ function! syntastic#util#ParseMagicNumber() return {'exe': exe, 'args': args} endif endfor + + return {'exe': '', 'args': []} endfunction let &cpo = s:save_cpo diff --git a/syntax_checkers/perl.vim b/syntax_checkers/perl.vim index 27326d55..b1baa333 100644 --- a/syntax_checkers/perl.vim +++ b/syntax_checkers/perl.vim @@ -40,7 +40,18 @@ function! SyntaxCheckers_perl_GetLocList() else let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%')) endif + let makeprg .= s:ExtraMakeprgArgs() + let errorformat = '%t:%f:%l:%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +function! s:ExtraMakeprgArgs() + let shebang = syntastic#util#ParseShebang() + if index(shebang['args'], '-T') != -1 + return ' -Tc' + endif + + return '' +endfunction