diff --git a/mode/perl.py b/mode/perl.py index 772a7f3..1206678 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -299,6 +299,9 @@ class Perl(mode.Fundamental): 'translate.end': ('magenta', 'default'), 'translate.null': ('magenta', 'default'), } + config = { + 'perl.lib': 'lib', + } def __init__(self, w): mode.Fundamental.__init__(self, w) @@ -321,7 +324,6 @@ class Perl(mode.Fundamental): # perl-specific self.functions = None - self.perllib = 'lib' def build_function_map(self): b = self.window.buffer @@ -352,7 +354,11 @@ class PerlCheckSyntax(Method): '''Check the syntax of a perl file''' def _execute(self, w, **vargs): app = w.application - cmd = "perl -c -I '%s' '%s'" % (w.mode.perllib, w.buffer.path) + perllib = w.application.config.get('perl.lib') + if perllib: + cmd = "perl -c -I '%s' '%s'" % (perllib, w.buffer.path) + else: + cmd = "perl -c '%s'" % (w.buffer.path) (status, output) = commands.getstatusoutput(cmd) if status == 0: app.set_error("Syntax OK") @@ -371,9 +377,12 @@ class PerlViewWordPerldoc(Method): '''View documentation about a package or function using perldoc''' def _try(self, w, word, asfunc=False): if asfunc: - cmd = "PERL5LIB=%r perldoc -t -T -f '%s'" % (w.mode.perllib, word) + cmd = "perldoc -t -T -f '%s'" % (word,) else: - cmd = "PERL5LIB=%r perldoc -t -T '%s'" % (w.mode.perllib, word) + cmd = "perldoc -t -T '%s'" % (word,) + perllib = w.application.config.get('perl.lib') + if perllib: + cmd = 'PERL5LIB=%r %s' % cmd (status, data) = commands.getstatusoutput(cmd) if status == 0: return data