Learning GNU Emacs, 3rd Edition
by Debra Cameron, James Elliott, Marc Loy, Eric S. Raymond, Bill Rosenblatt
Perl Support
Emacs has Perl support. Indeed, much like Perl itself, there are multiple ways to get things done—in this case, multiple Perl modes: the classic Perl mode (which comes up by default) and the more popular CPerl mode.
You should have a version of CPerl mode built right in, but you can also pick up the latest release from CPAN (the Comprehensive Perl Archive Network) online at http://www.cpan.org.
You can add one of the following pairs of lines to your .emacs file to make sure CPerl mode is invoked rather than Perl mode
;; load cperl-mode for perl files (fset 'perl-mode 'cperl-mode) ;; or maybe use an alias (defalias 'perl-mode 'cperl-mode)
CPerl mode is mostly like cc-mode with respect to motion and other programming language features. It also includes fun debug operations. You can start the debugger with M-x cperl-db. You'll be prompted to verify the debugger command and then be dropped into a split-screen mode. One buffer allows you to drive the normal perldb environment with all the regular commands you're accustomed to using in the Perl debugger.
The other buffer shows your script and follows along as you work through the debugger. It tracks the line you're about to execute as you issue commands in the other buffer. It's amazing how quickly you grow to depend on having such tools available while you're developing scripts. It is worth trying out if you've never done it before.
Perl Caveats
A big reason we wanted to mention Perl mode here is to highlight a few caveats. Perl ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access