Working with the Perl Editor
Prev |  | Next

## Working with the Perl Editor

### Syntax Check

EPIC performs on the fly syntax check of Perl source files. In order for the Syntax Check to work the Perl Interpreter has to be set up correctly (see Setting up Preferences).

The Syntax Check is performed after a defined idle period, after the user has stopped typing. This idle period can be configured in the preferences.

When an error/warning has been found the editor displays the appropriate icon in the annotation ruler (the gray bar on the left side of the editor), underlines the error in the source and inserts a marker into the Problems View window.

### Explain Errors and Warnings

In addition to displaying warnings and errors the editor is capable of explaining Errors and Warnings.

To get an Error/Warning explanation right-click the Error/Warning icon and select Explain Errors/Warnings from the dropdown menu.

The explanation(s) will be displayed in the Explain Errors/Warnings View.

### Perldoc

To retrieve perldoc information select a keyword or text and choose one of the perldoc options from the context menu.

If nothing is selected an input box will pop up.

If a perldoc entry is found it is displayed inside the Perldoc View.

NOTE: Perldoc has to be installed available in the system PATH, otherwise this feature will not work.

### Quick Reference

Apart from Perldoc support a quick reference feature is available. This feature has the advantage that no perldoc has to be installed on the system but does not provide as many information as perldoc.

To view the Quick Reference select a keyword and move the mouse pointer over the selection.

A tooltip with a short description of the keyword should appear.

### Code Assist

Code Assist features try to assist the user during source code editing.

NOTE: The features currently implemented in EPIC may not be fully functional but will be improved in the future.

#### Variable Inspection

When pressing one of the auto completion characters $ @ % the editor displays all defined variables in a list. From the list the user can select the variable that should be inserted in the source code.

#### Module Inspection

The editor tries to display methods available in modules when the auto completion characters > or: are pressed.

NOTE:

Currently the Indirect Object Invocation is not recognized by code assist.

This code block will not work:

$smtp = new Net::SMTP;[no content assist]

$smtp->

This one will work:

$smtp = Net::SMTP->new(.....);[content assist]

$smtp->

### TODO Markers

TODO Markers

are a very convenient way to add todos to the Eclipse task list.

A TODO marker is generated when a `#TODO anytext` is found in the Perl source code.

On deletion of the `#TODO` comment, the TODO Marker is also deleted.

### Templates

Templates allow for easy insertion of predefined text segments. In addition to normal text these segments can also include pre-defined variables that are included at runtime as well as variables that are specified by the user when the template is inserted.

#### Defining Templates

Templates are defined in the EPIC Preferences (Window > Preferences...).

To define a new template press the New... button.

To insert pre-defined variables press the Insert Variable... button.

In addition to pre-defined variables the user can specify additional variables ( using the syntax ${varname} ) which can be edited when the template is inserted. When the first variable is inserted variables with the same name will automatically be changed.

#### Using Templates

Templates are invoked by typing some characters and pressing Ctrl+Space.

Templates matching the typed characters will be displayed in a list. A preview is also available.

If the template contains user defined variables the user can press the TAB key to jump to the next variable after the template has been inserted.

### Source Formatter

EPIC uses PerlTidy for source code formatting (PerlTidy is included in the EPIC package).

To format the source code select Source > Format from the Eclipse menu or use Ctrl+shift+f.

PerlTidy settings can be changed in the Source Formatter preference page.

NOTE: Source formatting might take a while if the source code has a lot of lines.

### HTML Export

To export select Source > Export > HTML from the Eclipse menu and specify an output file.

HTML export settings can be changed in the Source Formatter preference page.

NOTE: For HTML export to work a working Source Formatter is needed.

### Outline View

The Outline View displays modules and subroutines. By clicking on the module/subroutine name the editor will jump to the appropriate position in the source code.

Subroutines named new will get a different icon.

Prev | Up | Next
Eclipse Basics | Home | Using the Perl Debugger