Function: perl-flymake
perl-flymake is an autoloaded and byte-compiled function defined in
perl-mode.el.gz.
Signature
(perl-flymake REPORT-FN &rest ARGS)
Documentation
Perl backend for Flymake.
Launch perl-flymake-command (which see) and pass to its
standard input the contents of the current buffer. The output of
this command is analyzed for error and warning messages.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/perl-mode.el.gz
;;;###autoload
(defun perl-flymake (report-fn &rest _args)
"Perl backend for Flymake.
Launch `perl-flymake-command' (which see) and pass to its
standard input the contents of the current buffer. The output of
this command is analyzed for error and warning messages."
(unless (executable-find (car perl-flymake-command))
(error "Cannot find a suitable checker"))
(when (process-live-p perl--flymake-proc)
(kill-process perl--flymake-proc))
(let ((source (current-buffer)))
(save-restriction
(widen)
(setq
perl--flymake-proc
(make-process
:name "perl-flymake" :noquery t :connection-type 'pipe
:buffer (generate-new-buffer " *perl-flymake*")
:command perl-flymake-command
:sentinel
(lambda (proc _event)
(when (eq 'exit (process-status proc))
(unwind-protect
(if (with-current-buffer source (eq proc perl--flymake-proc))
(with-current-buffer (process-buffer proc)
(goto-char (point-min))
(cl-loop
while (search-forward-regexp
"^\\(.+\\) at - line \\([0-9]+\\)"
nil t)
for msg = (match-string 1)
for (beg . end) = (flymake-diag-region
source
(string-to-number (match-string 2)))
for type =
(if (string-match
"\\(Scalar value\\|Useless use\\|Unquoted string\\)"
msg)
:warning
:error)
collect (flymake-make-diagnostic source
beg
end
type
msg)
into diags
finally (funcall report-fn diags)))
(flymake-log :debug "Canceling obsolete check %s"
proc))
(kill-buffer (process-buffer proc)))))))
(process-send-region perl--flymake-proc (point-min) (point-max))
(process-send-eof perl--flymake-proc))))