Created
May 24, 2012 04:45
-
-
Save sshaw/2779490 to your computer and use it in GitHub Desktop.
perl-module-version-after-point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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