1;(function()
2{
3	// CommonJS
4	SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5
6	function Brush()
7	{
8		// Contributed by David Simmons-Duffin and Marty Kube
9
10		var funcs =
11			'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
12			'chroot close closedir connect cos crypt defined delete each endgrent ' +
13			'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
14			'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
15			'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
16			'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
17			'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
18			'getservbyname getservbyport getservent getsockname getsockopt glob ' +
19			'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
20			'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
21			'oct open opendir ord pack pipe pop pos print printf prototype push ' +
22			'quotemeta rand read readdir readline readlink readpipe recv rename ' +
23			'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
24			'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
25			'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
26			'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
27			'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
28			'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
29			'undef unlink unpack unshift utime values vec wait waitpid warn write ' +
30			// feature
31			'say';
32
33		var keywords =
34			'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
35			'for foreach goto if import last local my next no our package redo ref ' +
36			'require return sub tie tied unless untie until use wantarray while ' +
37			// feature
38			'given when default ' +
39			// Try::Tiny
40			'try catch finally ' +
41			// Moose
42			'has extends with before after around override augment';
43
44		this.regexList = [
45			{ regex: /(<<|&lt;&lt;)((\w+)|(['"])(.+?)\4)[\s\S]+?\n\3\5\n/g,	css: 'string' },	// here doc (maybe html encoded)
46			{ regex: /#.*$/gm,										css: 'comments' },
47			{ regex: /^#!.*\n/g,									css: 'preprocessor' },	// shebang
48			{ regex: /-?\w+(?=\s*=(>|&gt;))/g,	css: 'string' }, // fat comma
49
50			// is this too much?
51			{ regex: /\bq[qwxr]?\([\s\S]*?\)/g,	css: 'string' }, // quote-like operators ()
52			{ regex: /\bq[qwxr]?\{[\s\S]*?\}/g,	css: 'string' }, // quote-like operators {}
53			{ regex: /\bq[qwxr]?\[[\s\S]*?\]/g,	css: 'string' }, // quote-like operators []
54			{ regex: /\bq[qwxr]?(<|&lt;)[\s\S]*?(>|&gt;)/g,	css: 'string' }, // quote-like operators <>
55			{ regex: /\bq[qwxr]?([^\w({<[])[\s\S]*?\1/g,	css: 'string' }, // quote-like operators non-paired
56
57			{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,	css: 'string' },
58			{ regex: SyntaxHighlighter.regexLib.singleQuotedString,	css: 'string' },
59			// currently ignoring single quote package separator and utf8 names
60			{ regex: /(?:&amp;|[$@%*]|\$#)\$?[a-zA-Z_](\w+|::)*/g,   		css: 'variable' },
61			{ regex: /\b__(?:END|DATA)__\b[\s\S]*$/g,				css: 'comments' },
62
63			// don't capture the newline after =cut so that =cut\n\n=head1 will start a new pod section
64			{ regex: /(^|\n)=\w[\s\S]*?(\n=cut\s*(?=\n)|$)/g,		css: 'comments' },		// pod
65
66			{ regex: new RegExp(this.getKeywords(funcs), 'gm'),		css: 'functions' },
67			{ regex: new RegExp(this.getKeywords(keywords), 'gm'),	css: 'keyword' }
68		];
69
70		this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
71	}
72
73	Brush.prototype	= new SyntaxHighlighter.Highlighter();
74	Brush.aliases		= ['perl', 'Perl', 'pl'];
75
76	SyntaxHighlighter.brushes.Perl = Brush;
77
78	// CommonJS
79	typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
80})();
81