get perl to use app.config

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-03-21 05:40:05 +00:00
parent de8920d5e0
commit 9cf78a89bc
1 changed files with 13 additions and 4 deletions

View File

@ -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