path: root/lisp/ob-perl.el
diff options
Diffstat (limited to 'lisp/ob-perl.el')
1 files changed, 13 insertions, 14 deletions
diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el
index 3a63837..a1aadbb 100644
--- a/lisp/ob-perl.el
+++ b/lisp/ob-perl.el
@@ -1,4 +1,4 @@
-;;; ob-perl.el --- org-babel functions for perl evaluation
+;;; ob-perl.el --- Babel Functions for Perl -*- lexical-binding: t; -*-
;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -28,7 +28,6 @@
;;; Code:
(require 'ob)
-(eval-when-compile (require 'cl))
(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("perl" . "pl"))
@@ -41,20 +40,20 @@
(defun org-babel-execute:perl (body params)
"Execute a block of Perl code with Babel.
This function is called by `org-babel-execute-src-block'."
- (let* ((session (cdr (assoc :session params)))
- (result-params (cdr (assoc :result-params params)))
- (result-type (cdr (assoc :result-type params)))
+ (let* ((session (cdr (assq :session params)))
+ (result-params (cdr (assq :result-params params)))
+ (result-type (cdr (assq :result-type params)))
(full-body (org-babel-expand-body:generic
body params (org-babel-variable-assignments:perl params)))
(session (org-babel-perl-initiate-session session)))
(org-babel-perl-evaluate session full-body result-type result-params)
- (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
+ (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
- (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))
+ (cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
-(defun org-babel-prep-session:perl (session params)
+(defun org-babel-prep-session:perl (_session _params)
"Prepare SESSION according to the header arguments in PARAMS."
(error "Sessions are not supported for Perl"))
@@ -63,7 +62,7 @@ This function is called by `org-babel-execute-src-block'."
(lambda (pair)
(org-babel-perl--var-to-perl (cdr pair) (car pair)))
- (mapcar #'cdr (org-babel-get-header params :var))))
+ (org-babel--get-vars params)))
;; helper functions
@@ -76,7 +75,7 @@ This function is called by `org-babel-execute-src-block'."
The elisp value, VAR, is converted to a string of perl source code
specifying a var of the same value."
(if varn
- (let ((org-babel-perl--lvl 0) (lvar (listp var)) prefix)
+ (let ((org-babel-perl--lvl 0) (lvar (listp var)))
(concat "my $" (symbol-name varn) "=" (when lvar "\n")
(org-babel-perl--var-to-perl var)
@@ -92,7 +91,7 @@ specifying a var of the same value."
(defvar org-babel-perl-buffers '(:default . nil))
-(defun org-babel-perl-initiate-session (&optional session params)
+(defun org-babel-perl-initiate-session (&optional _session _params)
"Return nil because sessions are not supported by perl."
@@ -136,13 +135,13 @@ return the value of the last statement in BODY, as elisp."
(tmp-babel-file (org-babel-process-file-name
tmp-file 'noquote)))
(let ((results
- (case result-type
- (output
+ (pcase result-type
+ (`output
(with-temp-file tmp-file
(org-babel-eval org-babel-perl-command body))
- (value
+ (`value
(org-babel-eval org-babel-perl-command
(format org-babel-perl-wrapper-method
body tmp-babel-file))))))