Книга: Learning GNU Emacs, 3rd Edition

9.6 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.

Оглавление книги

Оглавление статьи/книги

Генерация: 0.180. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз