Skip to content

Instantly share code, notes, and snippets.

@sshaw
Created May 24, 2012 04:45
Show Gist options
  • Save sshaw/2779490 to your computer and use it in GitHub Desktop.
Save sshaw/2779490 to your computer and use it in GitHub Desktop.
perl-module-version-after-point
; Need to remove font lock stuff before printing
(defun perl-module-version-after-point ()
(interactive)
(save-excursion
(if (search-forward-regexp "\\([A-Za-z]\\w*\\(::\\w+\\)*\\)" (point-at-eol) t)
(let* ((module (match-string 1))
; syntax for cmd.exe and *nix
(command (format "perl -e\"eval qq|require %s|; print %s->VERSION unless qq|$@|\"" module module))
(version (shell-command-to-string command)))
(message "%s: %s" module (if (string= version "") "unknown" version)))
(message "No module after point"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment