MidLifeXis has asked for the wisdom of the Perl Monks concerning the following question:

All,

Using XEmacs 21.4, cperl-mode, and Test::Inline blocks between =begin testing / =end testing blocks, has anyone made emacs treat the stuff between the =begin testing / =end testing blocks font lock and indent as perl code?

I would like a block like this...

=begin testing my $obj = foo(); is($obj, "blatz", "beer run(s)"); =end testing

... to act like ...

=begin testing =cut my $obj = foo(); is($obj, "blatz", "beer run(s)"); =end testing

... as far as cperl is concerned, but not use the =cut explicitly, since then perl chokes on it :)

Before I dig into the cperl source, I want to see if this river has already been crossed by another user.

--MidLifeXis

Replies are listed 'Best First'.
Re: cperl mode, XEmacs, and Test::Inline
by Fletch (Bishop) on May 11, 2005 at 15:17 UTC

    You're probably going to want to look into mmm-mode. It lets you have multiple modes active in a buffer inside different regions (for example for Mason components it behaves like HTML mode by default, but inside <%init></%init> blocks and what not it switches to cperl-mode).

Re: cperl mode, XEmacs, and Test::Inline
by LanX (Saint) on Mar 22, 2014 at 16:15 UTC
    Excellent question ... did you solve it in the meantime?

    IMHO a problem for all editors and a good argument against using POD for such stuff.

    a syntax like

    TEST { my $obj = foo(); is($obj, "blatz", "beer run(s)"); };

    could have solved this easily...

    update

    concerning this special problem, I'd just create a little LISP routine to toggle the POD to comments

    =begin test <-> #=begin test

    Thats pretty easily implemented w/o Lisp knowledge:

  • define a macro to use two regex
  • display lisp-code of macro
  • write lisp-function to .el file
  • assign function to hotkey

    Cheers Rolf

    ( addicted to the Perl Programming Language)