perl: add -Tc to makeprg if the shebang contains -T
If the shebang contains -T, then the makeprg looks like: perl '/path/to/efm_perl.pl' -c -w '/tmp/foo.pl' -Tc Mods to syntastic#util#ParseMagicNumber * rename it to ParseShebang (since this name seems more common) * return an empty result set rather than 0 so callers dont have to check if empty()
This commit is contained in:
parent
8540748d0c
commit
7353b32d77
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user