| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: Perl mode</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 |
<script src="../../lib/codemirror.js"></script> |
| 9 |
<script src="perl.js"></script> |
| 10 |
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> |
| 11 |
<div id=nav> |
| 12 |
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 13 |
|
| 14 |
<ul> |
| 15 |
<li><a href="../../index.html">Home</a> |
| 16 |
<li><a href="../../doc/manual.html">Manual</a> |
| 17 |
<li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 18 |
</ul> |
| 19 |
<ul> |
| 20 |
<li><a href="../index.html">Language modes</a> |
| 21 |
<li><a class=active href="#">Perl</a> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
|
| 25 |
<article> |
| 26 |
<h2>Perl mode</h2> |
| 27 |
|
| 28 |
|
| 29 |
<div><textarea id="code" name="code"> |
| 30 |
#!/usr/bin/perl |
| 31 |
|
| 32 |
use Something qw(func1 func2); |
| 33 |
|
| 34 |
# strings |
| 35 |
my $s1 = qq'single line'; |
| 36 |
our $s2 = q(multi- |
| 37 |
line); |
| 38 |
|
| 39 |
=item Something |
| 40 |
Example. |
| 41 |
=cut |
| 42 |
|
| 43 |
my $html=<<'HTML' |
| 44 |
<html> |
| 45 |
<title>hi!</title> |
| 46 |
</html> |
| 47 |
HTML |
| 48 |
|
| 49 |
print "first,".join(',', 'second', qq~third~); |
| 50 |
|
| 51 |
if($s1 =~ m[(?<!\s)(l.ne)\z]o) { |
| 52 |
$h->{$1}=$$.' predefined variables'; |
| 53 |
$s2 =~ s/\-line//ox; |
| 54 |
$s1 =~ s[ |
| 55 |
line ] |
| 56 |
[ |
| 57 |
block |
| 58 |
]ox; |
| 59 |
} |
| 60 |
|
| 61 |
1; # numbers and comments |
| 62 |
|
| 63 |
__END__ |
| 64 |
something... |
| 65 |
|
| 66 |
</textarea></div> |
| 67 |
|
| 68 |
<script> |
| 69 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 70 |
lineNumbers: true |
| 71 |
}); |
| 72 |
</script> |
| 73 |
|
| 74 |
<p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p> |
| 75 |
</article> |