help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (cperl-mode) Problems with syntax highlighting after __DATA__ !


From: LanX
Subject: Re: (cperl-mode) Problems with syntax highlighting after __DATA__ !
Date: Wed, 08 Dec 2010 15:32:59 -0000
User-agent: G2/1.0

On 22 Okt., 17:57, Ted Zlatanov <t...@lifelogs.com> wrote:
> __DATA__ begins a section that can be used through the DATA filehandle.
> It's a true here-file without interpolation and has no syntax.
>
> __END__ ends the Perl program and any __DATA__ effects.  Usually POD
> will follow but the Perl parser doesn't care (unlike =cut markers, which
> do matter to the Perl parser).  The POD extractor, usually `perldoc',
> will care.  So it's nice to the user to highlight it as POD.

Ted everything after the first __DATA__ or __END__ is just data, even
another __DATA__ or __END__

Just try this code:
----------------------
print while (<DATA>)
__DATA__
a
__END__
b
---------------------
you will see that everything after __DATA__ will be printed.

There are differences between __DATA__ and __END__ regarding package/
modul scope but this has no effect on highlighting or cperl.

And yes, moduls like  SelfLoader can be used to eval code in the DATA-
Section on demand, but IMHO SelfLoader is an edge case NOT the rule.

Anyway my preferred solution would be a syntax possibility or local
cperl-variable to decide if the DATA-Section should be highlighted as
perl code or not.

maybe something like

----------------------
package FOOBAR;
use SelfLoader;

__DATA__   #perl-code
sub bla {
   ...
}
---------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]