Configuring Perl Styles

The following section describes the color settings related to the Perl file type. These settings are available from the File Types tab of the Settings dialog.

 

       

 

 

Lexer Setting

Description

Back Ticks

The Back Ticks category applies to any text highlighted within the back tick operator `...` or the associated qx() method. The qx() operator acts just like using back ticks with the exception that the command string is automatically made safe for execution.

 

The following example demonstrates this category:

 

    

A second example demonstrates use of the qx method:

 

     

 

In this case the `echo test`,qx/echo test/ andqx/ls-al/ instances are categorized as "Back Ticks" and highlighted in the color and font specified by the user (red in this case).

 

Brace Highlighting

The Brace Highlighting category occurs when the cursor is adjacent to an opening brace that is matched by a closing brace or vice versa. Brace matching occurs on the following set of braces:

 

( and )

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening { of the subroutine and its closing } brace match (notice the cursor located adjacent to }) and are categorized as "Brace Highlighting" and highlighted in the color and font specified by the user (purple in this case).

 

Comments

 

The Comment category applies to the following comments within a Perl document:

 

  • standard multi-line comments:

#...

  • POD style comments:

=pod ... =cut

 

The following example demonstrates this category:

 

    

 

In this case the two comments are categorized as "Comments" and highlighted in the color and font specified by the user (red in this case).

 

Default

The Default category applies to virtual space that is not occupied by characters or whitespace. In this case both the foreground color and the font settings have no purpose, only the background color is used. It is provided to allow the user to maintain a consistent color across all styles when changing the background color.

 

The following example demonstrates this category:

 

    

 

In this case all virtual space that is not occupied by characters or whitespace is categorized as the "Default" category and highlighted in the color and font specified by the user (grey in this case).

 

Here-Documents

A Here Document is used to embed textual data directly within a Perl file without it being interpreted as Perl code:

 

The following example demonstrates this category:

 

    

 

In this example the Here Document starting with <<EOT; and ending with EOT at the beginning of the line delimits the Here Document. It is highlighted in the color and font specified by the user (red in this case).

 

The __DATA__ and __END__ keywords marking a block of data that is not interpreted by the Perl interpreter are treated as a special case of a Here Document and use the same coloring scheme as Here Documents.

 

The following example demonstrates this category:

 

    

 

In this case the text starting with __DATA__ is categorized as a special case of a Here Document and highlighted in the color and font specified by the user (red in this case).

 

Identifiers

The Identifiers category applies to such things as function names, declared constants,.library includes, etc..

 

The following example demonstrates this category:  

 

    

 

In this case the identifiers PI, and the two instances of printHashKeys are categorized as "Identifiers" and highlighted in the color and font specified by the user (red in this case).

 

Indent Guides

The Indent Guides category applies to the indent guides if they are displayed. Note that the font settings and background color do not apply.

 

The following example demonstrates the this category:

 

    

 

In this case the indent guides are displayed and highlighted in the color specified by the user (red in this case).

 

Keywords

The Keywords category applies to the Perl keywords that form part of the language standard.

 

The following example demonstrates this category:

 

    

 

In this case the words foreach, my, keys, print, and if are categorized as "Keywords" and are highlighted in the color and font specified by the user (red in this case).

 

Line Numbers

The Line Numbers category applies to the line numbers displayed in the left hand column.

 

The following example demonstrates this category:

 

    

 

In this case the line numbers are highlighted in the color and font specified by the user (purple on a grey background in this case).

 

Mismatched Brace

The Mismatched Brace category occurs when an opening brace has no closing brace or vice versa. This will only be displayed if the cursor currently located adjacent to the brace. Brace matching occurs on the following sets of braces:

 

( and )

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening { in the subroutine has no closing brace so it is categorized as "Mismatched Brace" and highlighted in the color and font specified by the user (red in this case).

 

Numbers

The Numbers category applies to any numbers contained in the file. Line numbers are categorized separately.

 

The following example demonstrates this category:

 

    

 

In this case the numbers 3.14, 22, and 34 are categorized as "Numbers" and are highlighted in the color and font specified by the user. (red in this case).

 

Operators

The Operators category applies to any operators contained in the file such as +, -, ++, <, >, etc. Note that braces are highlighted in an alternate color if the cursor is adjacent. Refer to the Brace Highlight and Bad Brace categories for more information.

 

The following example demonstrates this category:

 

    

 

In this case the operators =, {, }, [ , ], (, ) are categorized as "Operators" and are highlighted in the color and font specified by the user. (red in this case). The one exception is the { and }of the subroutine. They are categorized as "Brace Highlight" due to the cursor being adjacent to the closing }.

 

Regular Expressions

The Regular Expressions category applies to any regular expressions contained with the Perl document. This includes match, substitution, and any expressions using the qr() method. The qr() method is a convenient method of specifying a regular expression without having to escape internal characters.

 

The following example demonstrates this category:

 

    

In this case the /expression1/sg, m/expression2/sg, s/string/not a string/, tr/\n\r//d and qr/(match)/ are all categorized as "Regular Expressions" and highlighted in the color and font specified by the user (purple in this case).

 

Strings

The Strings category applies to strings that are enclosed in single quotes, double quotes, or declared using the q() or qq() methods.

 

The following example demonstrates this category:

 

   

 

In this example the 'single quoted string', "Double quoted string", q/A "single quoted" string/ and qq/Another quoted string/ are all classified as Strings and highlighted in the color and font specified by the user (red in this case).

 

Variables

The Variables category is used to control the style applied to the scalar, array, and hash variable declarations. This includes declarations of array variables using the qw() method.

 

The following example demonstrates this category:

 

        

 

In this case the array value @array, the hash value %hash and the scalar references $hashRef and $hash are categorized as Variables and highlighted in the color and font specified by the user (red in this case).

 

DEBUG BRAD: Does qw() belong here?

 

Whitespace and Control Characters

The Whitespace and Control characters category applies to any whitespace and control characters that are displayed. Due to a limitation in the underlying lexer, this option only changes the color of control characters. The font setting must be changed by the Control Character Font category.

 

The following example demonstrates this category:

 

    

 

In this case, any spaces, tabs or control characters are categorized as "Whitespace and Control Characters" and highlighted in the color and font specified by the user (underlined red in this case).