comparison lisp/modes/cperl-mode.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents e04119814345
children dbb370e3c29e
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
30 30
31 31
32 ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu 32 ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu
33 ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de 33 ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de
34 34
35 ;; $Id: cperl-mode.el,v 1.4 1997/03/16 05:55:19 steve Exp $ 35 ;; $Id: cperl-mode.el,v 1.1.1.1 1996/12/18 22:42:48 steve Exp $
36 36
37 ;;; To use this mode put the following into your .emacs file: 37 ;;; To use this mode put the following into your .emacs file:
38 38
39 ;; (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t) 39 ;; (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
40 40
43 43
44 ;; (setq cperl-hairy t) 44 ;; (setq cperl-hairy t)
45 45
46 ;;; in your .emacs file. (Emacs rulers do not consider it politically 46 ;;; in your .emacs file. (Emacs rulers do not consider it politically
47 ;;; correct to make whistles enabled by default.) 47 ;;; correct to make whistles enabled by default.)
48
49 ;;; DO NOT FORGET to read micro-docs. (available from `Perl' menu). <<<<<<
50 ;;; or as help on variables `cperl-tips', `cperl-problems', <<<<<<
51 ;;; `cperl-non-problems'. <<<<<<
52 48
53 ;;; Additional useful commands to put into your .emacs file: 49 ;;; Additional useful commands to put into your .emacs file:
54 50
55 ;; (setq auto-mode-alist 51 ;; (setq auto-mode-alist
56 ;; (append '(("\\.[pP][Llm]$" . perl-mode)) auto-mode-alist )) 52 ;; (append '(("\\.[pP][Llm]$" . perl-mode)) auto-mode-alist ))
329 ;;; comments and docstrings corrected, XEmacs support cleaned up. 325 ;;; comments and docstrings corrected, XEmacs support cleaned up.
330 ;;; The closing parenths would enclose the region into matching 326 ;;; The closing parenths would enclose the region into matching
331 ;;; parens under the same conditions as the opening ones. 327 ;;; parens under the same conditions as the opening ones.
332 ;;; Minor updates to `cperl-short-docs'. 328 ;;; Minor updates to `cperl-short-docs'.
333 ;;; Will not consider <<= as start of here-doc. 329 ;;; Will not consider <<= as start of here-doc.
334
335 ;;;; After 1.29
336 ;;; Added an extra advice to look into Micro-docs. ;-).
337 ;;; Enclosing of region when you press a closing parenth is regulated by
338 ;;; `cperl-electric-parens-string'.
339 ;;; Minor updates to `cperl-short-docs'.
340 ;;; `initialize-new-tags-table' called only if present (Does this help
341 ;;; with generation of tags under XEmacs?).
342 ;;; When creating/updating tag files, new info is written at the old place,
343 ;;; or at the end (is this a wanted behaviour? I need this in perl build directory).
344
345 ;;;; After 1.30
346 ;;; All the keywords from keywords.pl included (maybe with dummy explanation).
347 ;;; No auto-help inside strings, comment, here-docs, formats, and pods.
348 ;;; Shrinkwrapping of info, regulated by `cperl-max-help-size'.
349 ;;; Info on variables as well.
350 ;;; Recognision of HERE-DOCS improved yet more.
351 ;;; Autonewline works on `}' without warnings.
352 ;;; Autohelp works again on $_[0].
353
354 ;;;; After 1.31
355 ;;; perl-descr.el found its author - hi, Johan!
356 330
357 (defvar cperl-extra-newline-before-brace nil 331 (defvar cperl-extra-newline-before-brace nil
358 "*Non-nil means that if, elsif, while, until, else, for, foreach 332 "*Non-nil means that if, elsif, while, until, else, for, foreach
359 and do constructs look like: 333 and do constructs look like:
360 334
412 386
413 (defvar cperl-electric-lbrace-space nil 387 (defvar cperl-electric-lbrace-space nil
414 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceeded by ` '. 388 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceeded by ` '.
415 Can be overwritten by `cperl-hairy' if nil.") 389 Can be overwritten by `cperl-hairy' if nil.")
416 390
417 (defvar cperl-electric-parens-string "({[]})<" 391 (defvar cperl-electric-parens-string "({[<"
418 "*String of parentheses that should be electric in CPerl.") 392 "*String of parentheses that should be electric in CPerl.")
419 393
420 (defvar cperl-electric-parens nil 394 (defvar cperl-electric-parens nil
421 "*Non-nil (and non-null) means parentheses should be electric in CPerl. 395 "*Non-nil (and non-null) means parentheses should be electric in CPerl.
422 Can be overwritten by `cperl-hairy' if nil.") 396 Can be overwritten by `cperl-hairy' if nil.")
479 453
480 (defvar cperl-imenu-addback nil 454 (defvar cperl-imenu-addback nil
481 "*Not-nil means add backreferences to generated `imenu's. 455 "*Not-nil means add backreferences to generated `imenu's.
482 May require patched `imenu' and `imenu-go'.") 456 May require patched `imenu' and `imenu-go'.")
483 457
484 (defvar cperl-max-help-size 66
485 "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents.")
486
487 (defvar cperl-shrink-wrap-info-frame t
488 "*Non-nil means shrink-wrapping of info-buffer-frame allowed.")
489
490 (defvar cperl-info-page "perl" 458 (defvar cperl-info-page "perl"
491 "Name of the info page containing perl docs. 459 "Name of the info page containing perl docs.
492 Older version of this page was called `perl5', newer `perl'.") 460 Older version of this page was called `perl5', newer `perl'.")
493 461
494 462
577 *cannot* match parentheses in Perl 100% correctly. So 545 *cannot* match parentheses in Perl 100% correctly. So
578 1 if s#//#/#; 546 1 if s#//#/#;
579 will not break indentation, but 547 will not break indentation, but
580 1 if ( s#//#/# ); 548 1 if ( s#//#/# );
581 will. 549 will.
582
583 By similar reasons
584 s\"abc\"def\";
585 will confuse CPerl a lot.
586 550
587 If you still get wrong indentation in situation that you think the 551 If you still get wrong indentation in situation that you think the
588 code should be able to parse, try: 552 code should be able to parse, try:
589 553
590 a) Check what Emacs thinks about balance of your parentheses. 554 a) Check what Emacs thinks about balance of your parentheses.
1228 (skip-chars-backward " \t") 1192 (skip-chars-backward " \t")
1229 (eq (preceding-char) ?\)))) 1193 (eq (preceding-char) ?\))))
1230 (if cperl-auto-newline 1194 (if cperl-auto-newline
1231 (progn (cperl-indent-line) (newline) t) nil))) 1195 (progn (cperl-indent-line) (newline) t) nil)))
1232 (progn 1196 (progn
1197 (if cperl-auto-newline
1198 (setq insertpos (point)))
1233 (insert last-command-char) 1199 (insert last-command-char)
1234 (cperl-indent-line) 1200 (cperl-indent-line)
1235 (if cperl-auto-newline
1236 (setq insertpos (1- (point))))
1237 (if (and cperl-auto-newline (null only-before)) 1201 (if (and cperl-auto-newline (null only-before))
1238 (progn 1202 (progn
1239 (newline) 1203 (newline)
1240 (cperl-indent-line))) 1204 (cperl-indent-line)))
1241 (save-excursion 1205 (save-excursion
1316 "Insert a matching pair of parentheses if marking is active. 1280 "Insert a matching pair of parentheses if marking is active.
1317 If not, or if we are not at the end of marking range, would self-insert." 1281 If not, or if we are not at the end of marking range, would self-insert."
1318 (interactive "P") 1282 (interactive "P")
1319 (let ((beg (save-excursion (beginning-of-line) (point))) 1283 (let ((beg (save-excursion (beginning-of-line) (point)))
1320 (other-end (if (and cperl-electric-parens-mark 1284 (other-end (if (and cperl-electric-parens-mark
1321 (cperl-val 'cperl-electric-parens)
1322 (memq last-command-char
1323 (append cperl-electric-parens-string nil))
1324 (cperl-mark-active) 1285 (cperl-mark-active)
1325 (< (mark) (point))) 1286 (< (mark) (point)))
1326 (mark) 1287 (mark)
1327 nil)) 1288 nil))
1328 p) 1289 p)
2174 (search 2135 (search
2175 (concat 2136 (concat
2176 "\\(\\`\n?\\|\n\n\\)=" 2137 "\\(\\`\n?\\|\n\n\\)="
2177 "\\|" 2138 "\\|"
2178 ;; One extra () before this: 2139 ;; One extra () before this:
2179 "<<" 2140 "<<\\(\\([\"'`]\\)\\([^\"'`\n]*\\)\\3\\|\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)[^=]\\)" ; [^=] to avoid <<=.
2180 "\\("
2181 ;; First variant "BLAH" or just ``.
2182 "\\([\"'`]\\)"
2183 "\\([^\"'`\n]*\\)"
2184 "\\3"
2185 "\\|"
2186 ;; Second variant: Identifier or empty
2187 "\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)"
2188 ;; Check that we do not have <<= or << 30 or << $blah.
2189 "\\([^= \t$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)"
2190 "\\)"
2191 "\\|" 2141 "\\|"
2192 ;; 1+6 extra () before this: 2142 ;; 1+5 extra () before this:
2193 "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) 2143 "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$")))
2194 (unwind-protect 2144 (unwind-protect
2195 (progn 2145 (progn
2196 (save-excursion 2146 (save-excursion
2197 (message "Scanning for pods, formats and here-docs...") 2147 (message "Scanning for pods, formats and here-docs...")
2288 'syntax-type 'here-doc) 2238 'syntax-type 'here-doc)
2289 (cperl-put-do-not-fontify b (match-beginning 0))) 2239 (cperl-put-do-not-fontify b (match-beginning 0)))
2290 (t (message "End of here-document `%s' not found." tag))))) 2240 (t (message "End of here-document `%s' not found." tag)))))
2291 ;; format 2241 ;; format
2292 (t 2242 (t
2293 ;; 1+6=7 extra () before this: 2243 ;; 1+5=6 extra () before this:
2294 ;; "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"))) 2244 ;; "^[ \t]*format[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$")))
2295 (setq b (point) 2245 (setq b (point)
2296 name (if (match-beginning 8) ; 7 + 1 2246 name (if (match-beginning 7) ; 6 + 1
2297 (buffer-substring (match-beginning 8) ; 7 + 1 2247 (buffer-substring (match-beginning 7) ; 6 + 1
2298 (match-end 8)) ; 7 + 1 2248 (match-end 7)) ; 6 + 1
2299 "")) 2249 ""))
2300 (setq argument nil) 2250 (setq argument nil)
2301 (if cperl-pod-here-fontify 2251 (if cperl-pod-here-fontify
2302 (while (and (eq (forward-line) 0) 2252 (while (and (eq (forward-line) 0)
2303 (not (looking-at "^[.;]$"))) 2253 (not (looking-at "^[.;]$")))
3343 (interactive) 3293 (interactive)
3344 (require 'mode-compile) 3294 (require 'mode-compile)
3345 (let ((perl-dbg-flags "-wc")) 3295 (let ((perl-dbg-flags "-wc"))
3346 (mode-compile))) 3296 (mode-compile)))
3347 3297
3348 (defun cperl-info-buffer (type) 3298 (defun cperl-info-buffer ()
3349 ;; Returns buffer with documentation. Creates if missing. 3299 ;; Returns buffer with documentation. Creates if missing
3350 ;; If TYPE, this vars buffer. 3300 (let ((info (get-buffer "*info-perl*")))
3351 ;; Special care is taken to not stomp over an existing info buffer
3352 (let* ((bname (if type "*info-perl-var*" "*info-perl*"))
3353 (info (get-buffer bname))
3354 (oldbuf (get-buffer "*info*")))
3355 (if info info 3301 (if info info
3356 (save-window-excursion 3302 (save-window-excursion
3357 ;; Get Info running 3303 ;; Get Info running
3358 (require 'info) 3304 (require 'info)
3359 (cond (oldbuf
3360 (set-buffer oldbuf)
3361 (rename-buffer "*info-perl-tmp*")))
3362 (save-window-excursion 3305 (save-window-excursion
3363 (info)) 3306 (info))
3364 (Info-find-node cperl-info-page (if type "perlvar" "perlfunc")) 3307 (Info-find-node cperl-info-page "perlfunc")
3365 (set-buffer "*info*") 3308 (set-buffer "*info*")
3366 (rename-buffer bname) 3309 (rename-buffer "*info-perl*")
3367 (cond (oldbuf
3368 (set-buffer "*info-perl-tmp*")
3369 (rename-buffer "*info*")
3370 (set-buffer bname)))
3371 (make-variable-buffer-local 'window-min-height)
3372 (setq window-min-height 2)
3373 (current-buffer))))) 3310 (current-buffer)))))
3374 3311
3375 (defun cperl-word-at-point (&optional p) 3312 (defun cperl-word-at-point (&optional p)
3376 ;; Returns the word at point or at P. 3313 ;; Returns the word at point or at P.
3377 (save-excursion 3314 (save-excursion
3378 (if p (goto-char p)) 3315 (if p (goto-char p))
3379 (or (cperl-word-at-point-hard) 3316 (require 'etags)
3380 (progn 3317 (funcall (or (and (boundp 'find-tag-default-function)
3381 (require 'etags) 3318 find-tag-default-function)
3382 (funcall (or (and (boundp 'find-tag-default-function) 3319 (get major-mode 'find-tag-default-function)
3383 find-tag-default-function) 3320 ;; XEmacs 19.12 has `find-tag-default-hook'; it is
3384 (get major-mode 'find-tag-default-function) 3321 ;; automatically used within `find-tag-default':
3385 ;; XEmacs 19.12 has `find-tag-default-hook'; it is 3322 'find-tag-default))))
3386 ;; automatically used within `find-tag-default':
3387 'find-tag-default))))))
3388 3323
3389 (defun cperl-info-on-command (command) 3324 (defun cperl-info-on-command (command)
3390 "Shows documentation for Perl command in other window. 3325 "Shows documentation for Perl command in other window."
3391 If perl-info buffer is shown in some frame, uses this frame.
3392 Customized by setting variables `cperl-shrink-wrap-info-frame',
3393 `cperl-max-help-size'."
3394 (interactive 3326 (interactive
3395 (let* ((default (cperl-word-at-point)) 3327 (let* ((default (cperl-word-at-point))
3396 (read (read-string 3328 (read (read-string
3397 (format "Find doc for Perl function (default %s): " 3329 (format "Find doc for Perl function (default %s): "
3398 default)))) 3330 default))))
3400 default 3332 default
3401 read)))) 3333 read))))
3402 3334
3403 (let ((buffer (current-buffer)) 3335 (let ((buffer (current-buffer))
3404 (cmd-desc (concat "^" (regexp-quote command) "[^a-zA-Z_0-9]")) ; "tr///" 3336 (cmd-desc (concat "^" (regexp-quote command) "[^a-zA-Z_0-9]")) ; "tr///"
3405 pos isvar height iniheight frheight buf win fr1 fr2 iniwin not-loner 3337 pos)
3406 max-height char-height buf-list)
3407 (if (string-match "^-[a-zA-Z]$" command) 3338 (if (string-match "^-[a-zA-Z]$" command)
3408 (setq cmd-desc "^-X[ \t\n]")) 3339 (setq cmd-desc "^-X[ \t\n]"))
3409 (setq isvar (string-match "^[$@%]" command) 3340 (set-buffer (cperl-info-buffer))
3410 buf (cperl-info-buffer isvar)
3411 iniwin (selected-window)
3412 fr1 (window-frame iniwin))
3413 (set-buffer buf)
3414 (beginning-of-buffer) 3341 (beginning-of-buffer)
3415 (or isvar 3342 (re-search-forward "^-X[ \t\n]")
3416 (progn (re-search-forward "^-X[ \t\n]") 3343 (forward-line -1)
3417 (forward-line -1)))
3418 (if (re-search-forward cmd-desc nil t) 3344 (if (re-search-forward cmd-desc nil t)
3419 (progn 3345 (progn
3420 ;; Go back to beginning of the group (ex, for qq) 3346 (setq pos (progn (beginning-of-line)
3421 (if (re-search-backward "^[ \t\n\f]") 3347 (point)))
3422 (forward-line 1)) 3348 (pop-to-buffer (cperl-info-buffer))
3423 (beginning-of-line)
3424 ;; Get some of
3425 (setq pos (point)
3426 buf-list (list buf "*info-perl-var*" "*info-perl*"))
3427 (while (and (not win) buf-list)
3428 (setq win (get-buffer-window (car buf-list) t))
3429 (setq buf-list (cdr buf-list)))
3430 (or (not win)
3431 (eq (window-buffer win) buf)
3432 (set-window-buffer win buf))
3433 (and win (setq fr2 (window-frame win)))
3434 (if (or (not fr2) (eq fr1 fr2))
3435 (pop-to-buffer buf)
3436 (special-display-popup-frame buf) ; Make it visible
3437 (select-window win))
3438 (goto-char pos) ; Needed (?!).
3439 ;; Resize
3440 (setq iniheight (window-height)
3441 frheight (frame-height)
3442 not-loner (< iniheight (1- frheight))) ; Are not alone
3443 (cond ((if not-loner cperl-max-help-size
3444 cperl-shrink-wrap-info-frame)
3445 (setq height
3446 (+ 2
3447 (count-lines
3448 pos
3449 (save-excursion
3450 (if (re-search-forward
3451 "^[ \t][^\n]*\n+\\([^ \t\n\f]\\|\\'\\)" nil t)
3452 (match-beginning 0) (point-max)))))
3453 max-height
3454 (if not-loner
3455 (/ (* (- frheight 3) cperl-max-help-size) 100)
3456 (setq char-height (frame-char-height))
3457 ;; Non-functioning under OS/2:
3458 (if (eq char-height 1) (setq char-height 18))
3459 ;; Title, menubar, + 2 for slack
3460 (- (/ (x-display-pixel-height) char-height) 4)
3461 ))
3462 (if (> height max-height) (setq height max-height))
3463 ;;(message "was %s doing %s" iniheight height)
3464 (if not-loner
3465 (enlarge-window (- height iniheight))
3466 (set-frame-height (window-frame win) (1+ height)))))
3467 (set-window-start (selected-window) pos)) 3349 (set-window-start (selected-window) pos))
3468 (message "No entry for %s found." command)) 3350 (message "No entry for %s found." command))
3469 ;;(pop-to-buffer buffer) 3351 (pop-to-buffer buffer)))
3470 (select-window iniwin)))
3471 3352
3472 (defun cperl-info-on-current-command () 3353 (defun cperl-info-on-current-command ()
3473 "Shows documentation for Perl command at point in other window." 3354 "Shows documentation for Perl command at point in other window."
3474 (interactive) 3355 (interactive)
3475 (cperl-info-on-command (cperl-word-at-point))) 3356 (cperl-info-on-command (cperl-word-at-point)))
3490 imenu-create-index-function 3371 imenu-create-index-function
3491 imenu-prev-index-position-function 3372 imenu-prev-index-position-function
3492 imenu-extract-index-name-function 3373 imenu-extract-index-name-function
3493 (index-item (save-restriction 3374 (index-item (save-restriction
3494 (save-window-excursion 3375 (save-window-excursion
3495 (set-buffer (cperl-info-buffer nil)) 3376 (set-buffer (cperl-info-buffer))
3496 (setq imenu-create-index-function 3377 (setq imenu-create-index-function
3497 'imenu-default-create-index-function 3378 'imenu-default-create-index-function
3498 imenu-prev-index-position-function 3379 imenu-prev-index-position-function
3499 'cperl-imenu-info-imenu-search 3380 'cperl-imenu-info-imenu-search
3500 imenu-extract-index-name-function 3381 imenu-extract-index-name-function
3777 (t (cperl-write-tags file erase recurse t t))))) 3658 (t (cperl-write-tags file erase recurse t t)))))
3778 files)) 3659 files))
3779 ) 3660 )
3780 (t 3661 (t
3781 (setq xs (string-match "\\.xs$" file)) 3662 (setq xs (string-match "\\.xs$" file))
3782 (cond ((eq erase 'ignore) (goto-char (point-max))) 3663 (cond ((eq erase 'ignore) nil)
3783 (erase (erase-buffer)) 3664 (erase (erase-buffer))
3784 (t 3665 (t
3785 (goto-char 1) 3666 (goto-char 1)
3786 (if (search-forward (concat "\f\n" file ",") nil t) 3667 (if (search-forward (concat "\f\n" file ",") nil t)
3787 (progn 3668 (progn
3788 (search-backward "\f\n") 3669 (search-backward "\f\n")
3789 (delete-region (point) 3670 (delete-region (point)
3790 (progn 3671 (progn
3791 (forward-char 1) 3672 (forward-char 1)
3792 (search-forward "\f\n" nil 'toend) 3673 (search-forward "\f\n" nil 'toend)
3793 (point)))) 3674 (point)))
3794 (goto-char (point-max))))) 3675 (goto-char 1)))))
3795 (insert (cperl-find-tags file xs)))) 3676 (insert (cperl-find-tags file xs))))
3796 (if inbuffer nil ; Delegate to the caller 3677 (if inbuffer nil ; Delegate to the caller
3797 (save-buffer 0) ; No backup 3678 (save-buffer 0) ; No backup
3798 (if (fboundp 'initialize-new-tags-table) ; Do we need something special in XEmacs? 3679 (initialize-new-tags-table)))))
3799 (initialize-new-tags-table))))))
3800 3680
3801 (defvar cperl-tags-hier-regexp-list 3681 (defvar cperl-tags-hier-regexp-list
3802 "^\\(\\(package\\)\\>\\|sub\\>[^\n]+::\\|[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::\\|[ \t]*BOOT:\C-?[^\n]+::\\)") 3682 "^\\(\\(package\\)\\>\\|sub\\>[^\n]+::\\|[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::\\|[ \t]*BOOT:\C-?[^\n]+::\\)")
3803 3683
3804 (defvar cperl-hierarchy '(() ()) 3684 (defvar cperl-hierarchy '(() ())
4089 ;;; Getting help 3969 ;;; Getting help
4090 (defvar cperl-have-help-regexp 3970 (defvar cperl-have-help-regexp
4091 ;;(concat "\\(" 3971 ;;(concat "\\("
4092 (mapconcat 3972 (mapconcat
4093 'identity 3973 'identity
4094 '("[$@%*&][0-9a-zA-Z_:]+\\([ \t]*[[{]\\)?" ; Usual variable 3974 '("[$@%*&][0-9a-zA-Z_:]+" ; Usual variable
4095 "[$@]\\^[a-zA-Z]" ; Special variable 3975 "[$@]\\^[a-zA-Z]" ; Special variable
4096 "[$@][^ \n\t]" ; Special variable 3976 "[$@][^ \n\t]" ; Special variable
4097 "-[a-zA-Z]" ; File test 3977 "-[a-zA-Z]" ; File test
4098 "\\\\[a-zA-Z0]" ; Special chars 3978 "\\\\[a-zA-Z0]" ; Special chars
4099 "^=[a-z][a-zA-Z0-9_]*" ; Pod sections
4100 "[-!&*+,-./<=>?\\\\^|~]+" ; Operator 3979 "[-!&*+,-./<=>?\\\\^|~]+" ; Operator
4101 "[a-zA-Z_0-9:]+" ; symbol or number 3980 "[a-zA-Z_0-9:]+" ; symbol or number
4102 "x=" 3981 "x="
4103 "#!" 3982 "#!"
4104 ) 3983 )
4108 ;;"\\)" 3987 ;;"\\)"
4109 ;;) 3988 ;;)
4110 "Matches places in the buffer we can find help for.") 3989 "Matches places in the buffer we can find help for.")
4111 3990
4112 (defvar cperl-message-on-help-error t) 3991 (defvar cperl-message-on-help-error t)
4113 (defvar cperl-help-from-timer nil)
4114
4115 (defun cperl-word-at-point-hard ()
4116 ;; Does not save-excursion
4117 ;; Get to the something meaningful
4118 (or (eobp) (eolp) (forward-char 1))
4119 (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|~$%@]"
4120 (save-excursion (beginning-of-line) (point))
4121 'to-beg)
4122 ;; (cond
4123 ;; ((or (eobp) (looking-at "[][ \t\n{}();,]")) ; Not at a symbol
4124 ;; (skip-chars-backward " \n\t\r({[]});,")
4125 ;; (or (bobp) (backward-char 1))))
4126 ;; Try to backtrace
4127 (cond
4128 ((looking-at "[a-zA-Z0-9_:]") ; symbol
4129 (skip-chars-backward "[a-zA-Z0-9_:]")
4130 (cond
4131 ((and (eq (preceding-char) ?^) ; $^I
4132 (eq (char-after (- (point) 2)) ?\$))
4133 (forward-char -2))
4134 ((memq (preceding-char) (append "*$@%&\\" nil)) ; *glob
4135 (forward-char -1))
4136 ((and (eq (preceding-char) ?\=)
4137 (eq (current-column) 1))
4138 (forward-char -1))) ; =head1
4139 (if (and (eq (preceding-char) ?\<)
4140 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <FH>
4141 (forward-char -1)))
4142 ((and (looking-at "=") (eq (preceding-char) ?x)) ; x=
4143 (forward-char -1))
4144 ((and (looking-at "\\^") (eq (preceding-char) ?\$)) ; $^I
4145 (forward-char -1))
4146 ((looking-at "[-!&*+,-./<=>?\\\\^|~]")
4147 (skip-chars-backward "[-!&*+,-./<=>?\\\\^|~]")
4148 (cond
4149 ((and (eq (preceding-char) ?\$)
4150 (not (eq (char-after (- (point) 2)) ?\$))) ; $-
4151 (forward-char -1))
4152 ((and (eq (following-char) ?\>)
4153 (string-match "[a-zA-Z0-9_]" (char-to-string (preceding-char)))
4154 (save-excursion
4155 (forward-sexp -1)
4156 (and (eq (preceding-char) ?\<)
4157 (looking-at "\\$?[a-zA-Z0-9_:]+>")))) ; <FH>
4158 (search-backward "<"))))
4159 ((and (eq (following-char) ?\$)
4160 (eq (preceding-char) ?\<)
4161 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <$fh>
4162 (forward-char -1)))
4163 (if (looking-at cperl-have-help-regexp)
4164 (buffer-substring (match-beginning 0) (match-end 0))))
4165 3992
4166 (defun cperl-get-help () 3993 (defun cperl-get-help ()
4167 "Get one-line docs on the symbol at the point. 3994 "Get one-line docs on the symbol at the point.
4168 The data for these docs is a little bit obsolete and may be in fact longer 3995 The data for these docs is a little bit obsolete and may be in fact longer
4169 than a line. Your contribution to update/shorten it is appreciated." 3996 than a line. Your contribution to update/shorten it is appreciated."
4170 (interactive) 3997 (interactive)
4171 (save-excursion 3998 (save-excursion
4172 (let ((word (cperl-word-at-point-hard))) 3999 ;; Get to the something meaningful
4173 (if word 4000 (or (eobp) (eolp) (forward-char 1))
4174 (if (and cperl-help-from-timer ; Bail out if not in mainland 4001 (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|~$%@]"
4175 (not (string-match "^#!\\|\\\\\\|^=" word)) ; Show help even in comments/strings. 4002 (save-excursion (beginning-of-line) (point))
4176 (or (memq (get-text-property (point) 'face) 4003 'to-beg)
4177 '(font-lock-comment-face font-lock-string-face)) 4004 ;; (cond
4178 (memq (get-text-property (point) 'syntax-type) 4005 ;; ((or (eobp) (looking-at "[][ \t\n{}();,]")) ; Not at a symbol
4179 '(pod here-doc format)))) 4006 ;; (skip-chars-backward " \n\t\r({[]});,")
4180 nil 4007 ;; (or (bobp) (backward-char 1))))
4181 (cperl-describe-perl-symbol word)) 4008 ;; Try to backtrace
4182 (if cperl-message-on-help-error 4009 (cond
4183 (message "Nothing found for %s..." 4010 ((looking-at "[a-zA-Z0-9_:]") ; symbol
4184 (buffer-substring (point) (+ 5 (point))))))))) 4011 (skip-chars-backward "[a-zA-Z0-9_:]")
4012 (cond
4013 ((and (eq (preceding-char) ?^) ; $^I
4014 (eq (char-after (- (point) 2)) ?\$))
4015 (forward-char -2))
4016 ((memq (preceding-char) (append "*$@%&\\" nil)) ; *glob
4017 (forward-char -1)))
4018 (if (and (eq (preceding-char) ?\<)
4019 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <FH>
4020 (forward-char -1)))
4021 ((and (looking-at "=") (eq (preceding-char) ?x)) ; x=
4022 (forward-char -1))
4023 ((and (looking-at "\\^") (eq (preceding-char) ?\$)) ; $^I
4024 (forward-char -1))
4025 ((looking-at "[-!&*+,-./<=>?\\\\^|~]")
4026 (skip-chars-backward "[-!&*+,-./<=>?\\\\^|~]")
4027 (cond
4028 ((and (eq (preceding-char) ?\$)
4029 (not (eq (char-after (- (point) 2)) ?\$))) ; $-
4030 (forward-char -1))
4031 ((and (eq (following-char) ?\>)
4032 (string-match "[a-zA-Z0-9_]" (char-to-string (preceding-char)))
4033 (save-excursion
4034 (forward-sexp -1)
4035 (and (eq (preceding-char) ?\<)
4036 (looking-at "\\$?[a-zA-Z0-9_:]+>")))) ; <FH>
4037 (search-backward "<"))))
4038 ((and (eq (following-char) ?\$)
4039 (eq (preceding-char) ?\<)
4040 (looking-at "\\$?[a-zA-Z0-9_:]+>")) ; <$fh>
4041 (forward-char -1)))
4042 ;;(or (eobp) (forward-char 1))
4043 (if (looking-at cperl-have-help-regexp)
4044 (cperl-describe-perl-symbol
4045 (buffer-substring (match-beginning 0) (match-end 0)))
4046 (if cperl-message-on-help-error
4047 (message "Nothing found for %s..."
4048 (buffer-substring (point) (+ 5 (point))))))))
4185 4049
4186 ;;; Stolen from perl-descr.el by Johan Vromans: 4050 ;;; Stolen from perl-descr.el by Johan Vromans:
4187 4051
4188 (defvar cperl-doc-buffer " *perl-doc*" 4052 (defvar cperl-doc-buffer " *perl-doc*"
4189 "Where the documentation can be found.") 4053 "Where the documentation can be found.")
4190 4054
4191 (defun cperl-describe-perl-symbol (val) 4055 (defun cperl-describe-perl-symbol (val)
4192 "Display the documentation of symbol at point, a Perl operator." 4056 "Display the documentation of symbol at point, a Perl operator."
4193 (let ((enable-recursive-minibuffers t) 4057 ;; We suppose that the current position is at the start of the symbol
4058 ;; when we convert $_[5] to @_
4059 (let (;;(fn (perl-symbol-at-point))
4060 (enable-recursive-minibuffers t)
4061 ;;val
4194 args-file regexp) 4062 args-file regexp)
4063 ;; (interactive
4064 ;; (let ((fn (perl-symbol-at-point))
4065 ;; (enable-recursive-minibuffers t)
4066 ;; val args-file regexp)
4067 ;; (setq val (read-from-minibuffer
4068 ;; (if fn
4069 ;; (format "Symbol (default %s): " fn)
4070 ;; "Symbol: ")))
4071 ;; (if (string= val "")
4072 ;; (setq val fn))
4195 (cond 4073 (cond
4196 ((string-match "^[&*][a-zA-Z_]" val) 4074 ((string-match "^[&*][a-zA-Z_]" val)
4197 (setq val (concat (substring val 0 1) "NAME"))) 4075 (setq val (concat (substring val 0 1) "NAME")))
4198 ((string-match "^[$@]\\([a-zA-Z_:0-9]+\\)[ \t]*\\[" val) 4076 ((looking-at "[$@][a-zA-Z_:0-9]+\\([[{]\\)")
4199 (setq val (concat "@" (substring val 1 (match-end 1))))) 4077 (if (= ?\[ (char-after (match-beginning 1)))
4200 ((string-match "^[$@]\\([a-zA-Z_:0-9]+\\)[ \t]*{" val) 4078 (setq val (concat "@" (substring val 1)))
4201 (setq val (concat "%" (substring val 1 (match-end 1))))) 4079 (setq val (concat "%" (substring val 1)))))
4202 ((and (string= val "x") (string-match "^x=" val)) 4080 ((and (string= val "x") (looking-at "x="))
4203 (setq val "x=")) 4081 (setq val "x="))
4204 ((string-match "^\\$[\C-a-\C-z]" val) 4082 ((string-match "^\\$[\C-a-\C-z]" val)
4205 (setq val (concat "$^" (char-to-string (+ ?A -1 (aref val 1)))))) 4083 (setq val (concat "$^" (char-to-string (+ ?A -1 (aref val 1))))))
4206 ((string-match "^CORE::" val) 4084 ((and (string= "<" val) (looking-at "<\\$?[a-zA-Z0-9_:]+>"))
4207 (setq val "CORE::"))
4208 ((string-match "^SUPER::" val)
4209 (setq val "SUPER::"))
4210 ((and (string= "<" val) (string-match "^<\\$?[a-zA-Z0-9_:]+>" val))
4211 (setq val "<NAME>"))) 4085 (setq val "<NAME>")))
4212 (setq regexp (concat "^" 4086 ;;; (if (string-match "^[&*][a-zA-Z_]" val)
4213 "\\([^a-zA-Z0-9_:]+[ \t]+\\)?" 4087 ;;; (setq val (concat (substring val 0 1) "NAME"))
4088 ;;; (if (looking-at "[$@][a-zA-Z_:0-9]+\\([[{]\\)")
4089 ;;; (if (= ?\[ (char-after (match-beginning 1)))
4090 ;;; (setq val (concat "@" (substring val 1)))
4091 ;;; (setq val (concat "%" (substring val 1))))
4092 ;;; (if (and (string= val "x") (looking-at "x="))
4093 ;;; (setq val "x=")
4094 ;;; (if (looking-at "[$@][a-zA-Z_:0-9]")
4095 ;;; ))))
4096 (setq regexp (concat "^" "\\([^a-zA-Z0-9_:]+[ \t]\\)?"
4214 (regexp-quote val) 4097 (regexp-quote val)
4215 "\\([ \t([/]\\|$\\)")) 4098 "\\([ \t([/]\\|$\\)"))
4216 4099
4217 ;; get the buffer with the documentation text 4100 ;; get the buffer with the documentation text
4218 (cperl-switch-to-doc-buffer) 4101 (cperl-switch-to-doc-buffer)
4229 (message "%s" (buffer-substring lnstart (point))))) 4112 (message "%s" (buffer-substring lnstart (point)))))
4230 (if cperl-message-on-help-error 4113 (if cperl-message-on-help-error
4231 (message "No definition for %s" val))))))) 4114 (message "No definition for %s" val)))))))
4232 4115
4233 (defvar cperl-short-docs "Ignore my value" 4116 (defvar cperl-short-docs "Ignore my value"
4234 ;; Perl4 version was written by Johan Vromans (jvromans@squirrel.nl)
4235 "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5] 4117 "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5]
4236 ! ... Logical negation. 4118 ! Logical negation.
4237 ... != ... Numeric inequality. 4119 != Numeric inequality.
4238 ... !~ ... Search pattern, substitution, or translation (negated). 4120 !~ Search pattern, substitution, or translation (negated).
4239 $! In numeric context: errno. In a string context: error string. 4121 $! In numeric context: errno. In a string context: error string.
4240 $\" The separator which joins elements of arrays interpolated in strings. 4122 $\" The separator which joins elements of arrays interpolated in strings.
4241 $# The output format for printed numbers. Initial value is %.20g. 4123 $# The output format for printed numbers. Initial value is %.20g.
4242 $$ Process number of this script. Changes in the fork()ed child process. 4124 $$ The process number of the perl running this script. Altered (in the child process) by fork().
4243 $% The current page number of the currently selected output channel. 4125 $% The current page number of the currently selected output channel.
4244 4126
4245 The following variables are always local to the current block: 4127 The following variables are always local to the current block:
4246 4128
4247 $1 Match of the 1st set of parentheses in the last match (auto-local). 4129 $1 Match of the 1st set of parentheses in the last match (auto-local).
4263 $+ The last bracket matched by the last search pattern. 4145 $+ The last bracket matched by the last search pattern.
4264 $, The output field separator for the print operator. 4146 $, The output field separator for the print operator.
4265 $- The number of lines left on the page. 4147 $- The number of lines left on the page.
4266 $. The current input line number of the last filehandle that was read. 4148 $. The current input line number of the last filehandle that was read.
4267 $/ The input record separator, newline by default. 4149 $/ The input record separator, newline by default.
4268 $0 Name of the file containing the perl script being executed. May be set. 4150 $0 The name of the file containing the perl script being executed. May be set
4269 $: String may be broken after these characters to fill ^-lines in a format. 4151 $: The set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format.
4270 $; Subscript separator for multi-dim array emulation. Default \"\\034\". 4152 $; The subscript separator for multi-dimensional array emulation. Default is \"\\034\".
4271 $< The real uid of this process. 4153 $< The real uid of this process.
4272 $= The page length of the current output channel. Default is 60 lines. 4154 $= The page length of the current output channel. Default is 60 lines.
4273 $> The effective uid of this process. 4155 $> The effective uid of this process.
4274 $? The status returned by the last ``, pipe close or `system'. 4156 $? The status returned by the last ``, pipe close or `system'.
4275 $@ The perl error message from the last eval or do @var{EXPR} command. 4157 $@ The perl error message from the last eval or do @var{EXPR} command.
4289 $^P Internal debugging flag. 4171 $^P Internal debugging flag.
4290 $^T The time the script was started. Used by -A/-M/-C file tests. 4172 $^T The time the script was started. Used by -A/-M/-C file tests.
4291 $^W True if warnings are requested (perl -w flag). 4173 $^W True if warnings are requested (perl -w flag).
4292 $^X The name under which perl was invoked (argv[0] in C-speech). 4174 $^X The name under which perl was invoked (argv[0] in C-speech).
4293 $_ The default input and pattern-searching space. 4175 $_ The default input and pattern-searching space.
4294 $| Auto-flush after write/print on the current output channel? Default 0. 4176 $| Flag for auto-flush after write/print on the currently selected output channel. Default is 0.
4295 $~ The name of the current report format. 4177 $~ The name of the current report format.
4296 ... % ... Modulo division. 4178 % Modulo division.
4297 ... %= ... Modulo division assignment. 4179 %= Modulo division assignment.
4298 %ENV Contains the current environment. 4180 %ENV Contains the current environment.
4299 %INC List of files that have been require-d or do-ne. 4181 %INC List of files that have been require-d or do-ne.
4300 %SIG Used to set signal handlers for various signals. 4182 %SIG Used to set signal handlers for various signals.
4301 ... & ... Bitwise and. 4183 & Bitwise and.
4302 ... && ... Logical and. 4184 && Logical and.
4303 ... &&= ... Logical and assignment. 4185 &&= Logical and assignment.
4304 ... &= ... Bitwise and assignment. 4186 &= Bitwise and assignment.
4305 ... * ... Multiplication. 4187 * Multiplication.
4306 ... ** ... Exponentiation. 4188 ** Exponentiation.
4307 *NAME Glob: all objects refered by NAME. *NAM1 = *NAM2 aliases NAM1 to NAM2. 4189 *NAME Refers to all objects represented by NAME. *NAM1 = *NAM2 makes NAM1 a reference to NAM2.
4308 &NAME(arg0, ...) Subroutine call. Arguments go to @_. 4190 &NAME(arg0, ...) Subroutine call. Arguments go to @_.
4309 ... + ... Addition. +EXPR Makes EXPR into scalar context. 4191 + Addition.
4310 ++ Auto-increment (magical on strings). ++EXPR EXPR++ 4192 ++ Auto-increment (magical on strings).
4311 ... += ... Addition assignment. 4193 += Addition assignment.
4312 , Comma operator. 4194 , Comma operator.
4313 ... - ... Subtraction. 4195 - Subtraction.
4314 -- Auto-decrement (NOT magical on strings). --EXPR EXPR-- 4196 -- Auto-decrement.
4315 ... -= ... Subtraction assignment. 4197 -= Subtraction assignment.
4316 -A Access time in days since script started. 4198 -A Access time in days since script started.
4317 -B File is a non-text (binary) file. 4199 -B File is a non-text (binary) file.
4318 -C Inode change time in days since script started. 4200 -C Inode change time in days since script started.
4319 -M Age in days since script started. 4201 -M Age in days since script started.
4320 -O File is owned by real uid. 4202 -O File is owned by real uid.
4341 -x File is executable by effective uid. 4223 -x File is executable by effective uid.
4342 -z File has zero size. 4224 -z File has zero size.
4343 . Concatenate strings. 4225 . Concatenate strings.
4344 .. Alternation, also range operator. 4226 .. Alternation, also range operator.
4345 .= Concatenate assignment strings 4227 .= Concatenate assignment strings
4346 ... / ... Division. /PATTERN/ioxsmg Pattern match 4228 / Division. /PATTERN/ioxsmg Pattern match
4347 ... /= ... Division assignment. 4229 /= Division assignment.
4348 /PATTERN/ioxsmg Pattern match. 4230 /PATTERN/ioxsmg Pattern match.
4349 ... < ... Numeric less than. <pattern> Glob. See <NAME>, <> as well. 4231 < Numeric less than. <pattern> Glob. See <NAME>, <> as well.
4350 <NAME> Reads line from filehandle NAME. NAME must be bareword/dollar-bareword. 4232 <NAME> Reads line from filehandle NAME. NAME must be bareword/dollar-bareword.
4351 <pattern> Glob. (Unless pattern is bareword/dollar-bareword - see <NAME>) 4233 <pattern> Glob. (Unless pattern is bareword/dollar-bareword - see <NAME>)
4352 <> Reads line from union of files in @ARGV (= command line) and STDIN. 4234 <> Reads line from union of files in @ARGV (= command line) and STDIN.
4353 ... << ... Bitwise shift left. << start of HERE-DOCUMENT. 4235 << Bitwise shift left. << start of HERE-DOCUMENT.
4354 ... <= ... Numeric less than or equal to. 4236 <= Numeric less than or equal to.
4355 ... <=> ... Numeric compare. 4237 <=> Numeric compare.
4356 ... = ... Assignment. 4238 = Assignment.
4357 ... == ... Numeric equality. 4239 == Numeric equality.
4358 ... =~ ... Search pattern, substitution, or translation 4240 =~ Search pattern, substitution, or translation
4359 ... > ... Numeric greater than. 4241 > Numeric greater than.
4360 ... >= ... Numeric greater than or equal to. 4242 >= Numeric greater than or equal to.
4361 ... >> ... Bitwise shift right. 4243 >> Bitwise shift right.
4362 ... >>= ... Bitwise shift right assignment. 4244 >>= Bitwise shift right assignment.
4363 ... ? ... : ... Condition=if-then-else operator. ?PAT? One-time pattern match. 4245 ? : Alternation (if-then-else) operator. ?PAT? Backwards pattern match.
4364 ?PATTERN? One-time pattern match. 4246 ?PATTERN? Backwards pattern match.
4365 @ARGV Command line arguments (not including the command name - see $0). 4247 @ARGV Command line arguments (not including the command name - see $0).
4366 @INC List of places to look for perl scripts during do/include/use. 4248 @INC List of places to look for perl scripts during do/include/use.
4367 @_ Parameter array for subroutines. Also used by split unless in array context. 4249 @_ Parameter array for subroutines. Also used by split unless in array context.
4368 \\ Creates a reference to whatever follows, like \$var. 4250 \\ Creates a reference to whatever follows, like \$var.
4369 \\0 Octal char, e.g. \\033. 4251 \\0 Octal char, e.g. \\033.
4370 \\E Case modification terminator. See \\Q, \\L, and \\U. 4252 \\E Case modification terminator. See \\Q, \\L, and \\U.
4371 \\L Lowercase until \\E . See also \l, lc. 4253 \\L Lowercase until \\E .
4372 \\U Upcase until \\E . See also \u, uc. 4254 \\U Upcase until \\E .
4373 \\Q Quote metacharacters until \\E . See also quotemeta. 4255 \\Q Quote metacharacters until \\E .
4374 \\a Alarm character (octal 007). 4256 \\a Alarm character (octal 007).
4375 \\b Backspace character (octal 010). 4257 \\b Backspace character (octal 010).
4376 \\c Control character, e.g. \\c[ . 4258 \\c Control character, e.g. \\c[ .
4377 \\e Escape character (octal 033). 4259 \\e Escape character (octal 033).
4378 \\f Formfeed character (octal 014). 4260 \\f Formfeed character (octal 014).
4379 \\l Lowercase the next character. See also \\L and \\u, lcfirst, 4261 \\l Lowercase of next character. See also \\L and \\u,
4380 \\n Newline character (octal 012). 4262 \\n Newline character (octal 012).
4381 \\r Return character (octal 015). 4263 \\r Return character (octal 015).
4382 \\t Tab character (octal 011). 4264 \\t Tab character (octal 011).
4383 \\u Upcase the next character. See also \\U and \\l, ucfirst, 4265 \\u Upcase of next character. See also \\U and \\l,
4384 \\x Hex character, e.g. \\x1b. 4266 \\x Hex character, e.g. \\x1b.
4385 ^ ... Bitwise exclusive or. 4267 ^ Bitwise exclusive or.
4386 __END__ Ends program source. 4268 __END__ End of program source.
4387 __DATA__ Ends program source. 4269 __DATA__ End of program source.
4388 __FILE__ Current (source) filename. 4270 __FILE__ Current (source) filename.
4389 __LINE__ Current line in current source. 4271 __LINE__ Current line in current source.
4390 ARGV Default multi-file input filehandle. <ARGV> is a synonym for <>. 4272 ARGV Default multi-file input filehandle. <ARGV> is a synonym for <>.
4391 ARGVOUT Output filehandle with -i flag. 4273 ARGVOUT Output filehandle with -i flag.
4392 BEGIN { ... } Immediately executed (during compilation) piece of code. 4274 BEGIN { block } Immediately executed (during compilation) piece of code.
4393 END { ... } Pseudo-subroutine executed after the script finishes. 4275 END { block } Pseudo-subroutine executed after the script finishes.
4394 DATA Input filehandle for what follows after __END__ or __DATA__. 4276 DATA Input filehandle for what follows after __END__ or __DATA__.
4395 accept(NEWSOCKET,GENERICSOCKET) 4277 accept(NEWSOCKET,GENERICSOCKET)
4396 alarm(SECONDS) 4278 alarm(SECONDS)
4397 atan2(X,Y) 4279 atan2(X,Y)
4398 bind(SOCKET,NAME) 4280 bind(SOCKET,NAME)
4403 chop[(LIST|VAR)] 4285 chop[(LIST|VAR)]
4404 chown(LIST) 4286 chown(LIST)
4405 chroot(FILENAME) 4287 chroot(FILENAME)
4406 close(FILEHANDLE) 4288 close(FILEHANDLE)
4407 closedir(DIRHANDLE) 4289 closedir(DIRHANDLE)
4408 ... cmp ... String compare. 4290 cmp String compare.
4409 connect(SOCKET,NAME) 4291 connect(SOCKET,NAME)
4410 continue of { block } continue { block }. Is executed after `next' or at end. 4292 continue of { block } continue { block }. Is executed after `next' or at end.
4411 cos(EXPR) 4293 cos(EXPR)
4412 crypt(PLAINTEXT,SALT) 4294 crypt(PLAINTEXT,SALT)
4413 dbmclose(%HASH) 4295 dbmclose(ASSOC_ARRAY)
4414 dbmopen(%HASH,DBNAME,MODE) 4296 dbmopen(ASSOC,DBNAME,MODE)
4415 defined(EXPR) 4297 defined(EXPR)
4416 delete($HASH{KEY}) 4298 delete($ASSOC{KEY})
4417 die(LIST) 4299 die(LIST)
4418 do { ... }|SUBR while|until EXPR executes at least once 4300 do { ... }|SUBR while|until EXPR executes at least once
4419 do(EXPR|SUBR([LIST])) 4301 do(EXPR|SUBR([LIST]))
4420 dump LABEL 4302 dump LABEL
4421 each(%HASH) 4303 each(ASSOC_ARRAY)
4422 endgrent 4304 endgrent
4423 endhostent 4305 endhostent
4424 endnetent 4306 endnetent
4425 endprotoent 4307 endprotoent
4426 endpwent 4308 endpwent
4427 endservent 4309 endservent
4428 eof[([FILEHANDLE])] 4310 eof[([FILEHANDLE])]
4429 ... eq ... String equality. 4311 eq String equality.
4430 eval(EXPR) or eval { BLOCK } 4312 eval(EXPR) or eval { BLOCK }
4431 exec(LIST) 4313 exec(LIST)
4432 exit(EXPR) 4314 exit(EXPR)
4433 exp(EXPR) 4315 exp(EXPR)
4434 fcntl(FILEHANDLE,FUNCTION,SCALAR) 4316 fcntl(FILEHANDLE,FUNCTION,SCALAR)
4435 fileno(FILEHANDLE) 4317 fileno(FILEHANDLE)
4436 flock(FILEHANDLE,OPERATION) 4318 flock(FILEHANDLE,OPERATION)
4437 for (EXPR;EXPR;EXPR) { ... } 4319 for (EXPR;EXPR;EXPR) { ... }
4438 foreach [VAR] (@ARRAY) { ... } 4320 foreach [VAR] (@ARRAY) { ... }
4439 fork 4321 fork
4440 ... ge ... String greater than or equal. 4322 ge String greater than or equal.
4441 getc[(FILEHANDLE)] 4323 getc[(FILEHANDLE)]
4442 getgrent 4324 getgrent
4443 getgrgid(GID) 4325 getgrgid(GID)
4444 getgrnam(NAME) 4326 getgrnam(NAME)
4445 gethostbyaddr(ADDR,ADDRTYPE) 4327 gethostbyaddr(ADDR,ADDRTYPE)
4465 getsockname(SOCKET) 4347 getsockname(SOCKET)
4466 getsockopt(SOCKET,LEVEL,OPTNAME) 4348 getsockopt(SOCKET,LEVEL,OPTNAME)
4467 gmtime(EXPR) 4349 gmtime(EXPR)
4468 goto LABEL 4350 goto LABEL
4469 grep(EXPR,LIST) 4351 grep(EXPR,LIST)
4470 ... gt ... String greater than. 4352 gt String greater than.
4471 hex(EXPR) 4353 hex(EXPR)
4472 if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR 4354 if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR
4473 index(STR,SUBSTR[,OFFSET]) 4355 index(STR,SUBSTR[,OFFSET])
4474 int(EXPR) 4356 int(EXPR)
4475 ioctl(FILEHANDLE,FUNCTION,SCALAR) 4357 ioctl(FILEHANDLE,FUNCTION,SCALAR)
4476 join(EXPR,LIST) 4358 join(EXPR,LIST)
4477 keys(%HASH) 4359 keys(ASSOC_ARRAY)
4478 kill(LIST) 4360 kill(LIST)
4479 last [LABEL] 4361 last [LABEL]
4480 ... le ... String less than or equal. 4362 le String less than or equal.
4481 length(EXPR) 4363 length(EXPR)
4482 link(OLDFILE,NEWFILE) 4364 link(OLDFILE,NEWFILE)
4483 listen(SOCKET,QUEUESIZE) 4365 listen(SOCKET,QUEUESIZE)
4484 local(LIST) 4366 local(LIST)
4485 localtime(EXPR) 4367 localtime(EXPR)
4486 log(EXPR) 4368 log(EXPR)
4487 lstat(EXPR|FILEHANDLE|VAR) 4369 lstat(EXPR|FILEHANDLE|VAR)
4488 ... lt ... String less than. 4370 lt String less than.
4489 m/PATTERN/iogsmx 4371 m/PATTERN/iogsmx
4490 mkdir(FILENAME,MODE) 4372 mkdir(FILENAME,MODE)
4491 msgctl(ID,CMD,ARG) 4373 msgctl(ID,CMD,ARG)
4492 msgget(KEY,FLAGS) 4374 msgget(KEY,FLAGS)
4493 msgrcv(ID,VAR,SIZE,TYPE.FLAGS) 4375 msgrcv(ID,VAR,SIZE,TYPE.FLAGS)
4494 msgsnd(ID,MSG,FLAGS) 4376 msgsnd(ID,MSG,FLAGS)
4495 my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH). 4377 my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH).
4496 ... ne ... String inequality. 4378 ne String inequality.
4497 next [LABEL] 4379 next [LABEL]
4498 oct(EXPR) 4380 oct(EXPR)
4499 open(FILEHANDLE[,EXPR]) 4381 open(FILEHANDLE[,EXPR])
4500 opendir(DIRHANDLE,EXPR) 4382 opendir(DIRHANDLE,EXPR)
4501 ord(EXPR) 4383 ord(EXPR)
4502 pack(TEMPLATE,LIST) 4384 pack(TEMPLATE,LIST)
4503 package NAME Introduces package context. 4385 package Introduces package context.
4504 pipe(READHANDLE,WRITEHANDLE) 4386 pipe(READHANDLE,WRITEHANDLE)
4505 pop(ARRAY) 4387 pop(ARRAY)
4506 print [FILEHANDLE] [(LIST)] 4388 print [FILEHANDLE] [(LIST)]
4507 printf [FILEHANDLE] (FORMAT,LIST) 4389 printf [FILEHANDLE] (FORMAT,LIST)
4508 push(ARRAY,LIST) 4390 push(ARRAY,LIST)
4557 sprintf(FORMAT,LIST) 4439 sprintf(FORMAT,LIST)
4558 sqrt(EXPR) 4440 sqrt(EXPR)
4559 srand(EXPR) 4441 srand(EXPR)
4560 stat(EXPR|FILEHANDLE|VAR) 4442 stat(EXPR|FILEHANDLE|VAR)
4561 study[(SCALAR)] 4443 study[(SCALAR)]
4562 sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...} 4444 sub [NAME [(format)]] { BODY } or sub [NAME [(format)]];
4563 substr(EXPR,OFFSET[,LEN]) 4445 substr(EXPR,OFFSET[,LEN])
4564 symlink(OLDFILE,NEWFILE) 4446 symlink(OLDFILE,NEWFILE)
4565 syscall(LIST) 4447 syscall(LIST)
4566 sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) 4448 sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET])
4567 system(LIST) 4449 system(LIST)
4576 undef[(EXPR)] 4458 undef[(EXPR)]
4577 unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR 4459 unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR
4578 unlink(LIST) 4460 unlink(LIST)
4579 unpack(TEMPLATE,EXPR) 4461 unpack(TEMPLATE,EXPR)
4580 unshift(ARRAY,LIST) 4462 unshift(ARRAY,LIST)
4581 until (EXPR) { ... } EXPR until EXPR 4463 until (EXPR) { ... } or EXPR until EXPR
4582 utime(LIST) 4464 utime(LIST)
4583 values(%HASH) 4465 values(ASSOC_ARRAY)
4584 vec(EXPR,OFFSET,BITS) 4466 vec(EXPR,OFFSET,BITS)
4585 wait 4467 wait
4586 waitpid(PID,FLAGS) 4468 waitpid(PID,FLAGS)
4587 wantarray 4469 wantarray
4588 warn(LIST) 4470 warn(LIST)
4589 while (EXPR) { ... } EXPR while EXPR 4471 while (EXPR) { ... } or EXPR while EXPR
4590 write[(EXPR|FILEHANDLE)] 4472 write[(EXPR|FILEHANDLE)]
4591 ... x ... Repeat string or array. 4473 x Repeat string or array.
4592 x= ... Repetition assignment. 4474 x= Repetition assignment.
4593 y/SEARCHLIST/REPLACEMENTLIST/ 4475 y/SEARCHLIST/REPLACEMENTLIST/
4594 ... | ... Bitwise or. 4476 | Bitwise or.
4595 ... || ... Logical or. 4477 || Logical or.
4596 ~ ... Unary bitwise complement. 4478 ~ Unary bitwise complement.
4597 #! OS interpreter indicator. If contains `perl', used for options, and -x. 4479 #! OS interpreter indicator. If contains `perl', used for options, and -x.
4598 AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'.
4599 CORE:: Prefix to access builtin function if imported sub obscures it.
4600 SUPER:: Prefix to lookup for a method in @ISA classes.
4601 DESTROY Shorthand for `sub DESTROY {...}'.
4602 ... EQ ... Obsolete synonym of `eq'.
4603 ... GE ... Obsolete synonym of `ge'.
4604 ... GT ... Obsolete synonym of `gt'.
4605 ... LE ... Obsolete synonym of `le'.
4606 ... LT ... Obsolete synonym of `lt'.
4607 ... NE ... Obsolete synonym of `ne'.
4608 abs [ EXPR ] absolute value
4609 ... and ... Low-precedence synonym for &&.
4610 bless REFERENCE [, PACKAGE] Makes reference into an object of a package.
4611 chomp Docs missing
4612 chr Docs missing
4613 else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
4614 elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
4615 exists $HASH{KEY} True if the key exists.
4616 format Docs missing
4617 formline Docs missing
4618 glob EXPR Synonym of <EXPR>.
4619 lc [ EXPR ] Returns lowercased EXPR.
4620 lcfirst [ EXPR ] Returns EXPR with lower-cased first letter.
4621 map Docs missing
4622 no PACKAGE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method.
4623 ... not ... Low-precedence synonym for ! - negation.
4624 ... or ... Low-precedence synonym for ||.
4625 pos STRING Set/Get end-position of the last match over this string, see \\G.
4626 quotemeta [ EXPR ] Quote metacharacters.
4627 qw Docs missing
4628 readline FH Synonym of <FH>.
4629 readpipe CMD Synonym of `CMD`.
4630 ref [ EXPR ] Type of EXPR when dereferenced.
4631 sysopen Docs missing
4632 tie Docs missing
4633 tied Docs missing
4634 uc [ EXPR ] Returns upcased EXPR.
4635 ucfirst [ EXPR ] Returns EXPR with upcased first letter.
4636 untie Docs missing
4637 use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'.
4638 ... xor ... Low-precedence synonym for exclusive or.
4639 prototype \&SUB Returns prototype of the function given a reference.
4640 =head1 Top-level heading.
4641 =head2 Second-level heading.
4642 =head3 Third-level heading (is there such?).
4643 =over [ NUMBER ] Start list.
4644 =item [ TITLE ] Start new item in the list.
4645 =back End list.
4646 =cut Switch from POD to Perl.
4647 =pod Switch from Perl to POD.
4648 ") 4480 ")
4649 4481
4650 (defun cperl-switch-to-doc-buffer () 4482 (defun cperl-switch-to-doc-buffer ()
4651 "Go to the perl documentation buffer and insert the documentation." 4483 "Go to the perl documentation buffer and insert the documentation."
4652 (interactive) 4484 (interactive)
4688 (defun cperl-lazy-hook () 4520 (defun cperl-lazy-hook ()
4689 (setq cperl-help-shown nil)) 4521 (setq cperl-help-shown nil))
4690 4522
4691 (defun cperl-get-help-defer () 4523 (defun cperl-get-help-defer ()
4692 (if (not (eq major-mode 'perl-mode)) nil 4524 (if (not (eq major-mode 'perl-mode)) nil
4693 (let ((cperl-message-on-help-error nil) (cperl-help-from-timer t)) 4525 (let ((cperl-message-on-help-error nil))
4694 (cperl-get-help) 4526 (cperl-get-help)
4695 (setq cperl-help-shown t)))) 4527 (setq cperl-help-shown t))))
4696 (cperl-lazy-install))) 4528 (cperl-lazy-install)))