Perl is a great reporting language. It just happens to be inconvenient to run reports and get them into a text editor so I can look at them. This fixes that by making it easy to run perl scripts and have the output show up in a new buffer.

Usage. This creates functions for your scripts so the function to call is up to you.

M-x nab-duplicate-usernames

An example copied from my .emacs file.

;; Domino address book stuff (perl-script nab-duplicate-employeeids "Fetch duplicate NAB employeeids" "Notes\\NAB\\DuplicateEmployeeIDs.pl") (perl-script nab-mismatch-employeeid-case "Fetch employeeids with mismatched case (AggDb vs NAB)" "Notes\\NAB\\MismatchCase.pl") (perl-script nab-duplicate-employeeids-harder "Fetch duplicate NAB employeeids harder" "Notes\\NAB\\DuplicateEmployeeIDsHarder.pl") (perl-script aggregation-duplicate-employeeids "Fetch duplicate Aggregation Db usernames" "Notes\\NAB\\AggDb-DuplicateEmployeeIDs.pl") (perl-script nab-duplicate-usernames "Fetch duplicate NAB usernames" "Notes\\NAB\\DuplicateUsernames.pl") (perl-script nab-inactive-users-in-nab "Fetch ex-employees in the NAB" "Notes\\NAB\\GDInactiveInNAB.pl")

Add the perl-script macro and some configuration variables to your .emacs file.

;; Wrap perl scripts with emacs (setq perl-program "C:\\perl\\bin\\perl.exe") (setq perl-script-path "C:\\usr\\local\\bin\\") (defmacro perl-script (name description executable) `(defun ,name () ,description (interactive) (let ((buf (generate-new-buffer ,(symbol-name name)))) (shell-command ,(concat perl-program " " perl-script-path executable) buf) buf)))

In reply to Wrap perl scripts in emacs by diotalevi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.