
"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'
    base_cmd = ('perl -c')
    regex = r'(?P<message>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        full_cmd = self.base_cmd

        settings = self.get_view_settings()

        include_dirs = settings.get('include_dirs', [])

        if include_dirs:
            full_cmd += ' ' . join([' -I ' + shlex.quote(include)
                                   for include in include_dirs])

        return full_cmd


"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'

    regex = r'(?P<message>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        command = [self.executable_path, '-c']

        include_dirs = self.get_view_settings().get('include_dirs', [])

        for e in include_dirs:
            command.append('-I')
            command.append(shlex.quote(e))

        return command

Clean up include dir code
Clean up include dir code

  
  """This module exports the Perl plugin class."""
  
  import shlex
  from SublimeLinter.lint import Linter, util
  
  
  class Perl(Linter):
  
      """Provides an interface to perl -c."""
  
      syntax = ('modernperl', 'perl')
      executable = 'perl'
-     base_cmd = ('perl -c')
+ 
      regex = r'(?P<message>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
      error_stream = util.STREAM_STDERR
  
      def cmd(self):
          """
          Return the command line to execute.
  
          Overridden so we can add include paths based on the 'include_dirs'
          settings.
  
          """
  
-         full_cmd = self.base_cmd
+         command = [self.executable_path, '-c']
  
-         settings = self.get_view_settings()
+         include_dirs = self.get_view_settings().get('include_dirs', [])
  
-         include_dirs = settings.get('include_dirs', [])
+         for e in include_dirs:
+             command.append('-I')
+             command.append(shlex.quote(e))
  
+         return command
-         if include_dirs:
-             full_cmd += ' ' . join([' -I ' + shlex.quote(include)
-                                    for include in include_dirs])
  
-         return full_cmd
- 
Clean up include dir code
## Code Before:

"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'
    base_cmd = ('perl -c')
    regex = r'(?P<message>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        full_cmd = self.base_cmd

        settings = self.get_view_settings()

        include_dirs = settings.get('include_dirs', [])

        if include_dirs:
            full_cmd += ' ' . join([' -I ' + shlex.quote(include)
                                   for include in include_dirs])

        return full_cmd

## Instruction:
Clean up include dir code
## Code After:

"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'

    regex = r'(?P<message>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        command = [self.executable_path, '-c']

        include_dirs = self.get_view_settings().get('include_dirs', [])

        for e in include_dirs:
            command.append('-I')
            command.append(shlex.quote(e))

        return command
