Automatic syntax checking

 

While typing, your script can be checked automatically for errors and warnings:

 

autosyntaxcheck

 

Customizing of whether this feature will be enabled, and coloring of the offending lines can be done in Options / Error testing.

 

When moving the cursor on to an offending line, the status bar at the bottom of the editor displays the error. Also all errors and warnings can be show in the code explorer under the Error or Warnings node.

 

You can set up automatic syntax checking from the Options Dialog / Error Testing.

 

Another option ("disable on paths") is to disable automatic syntax checking when the file is located under some drives or folders. The paths can include the standard perl libraries which are known to be error-free. Example:

 

c:\perl\lib; c:\perl\site\lib; Y:\; \\computer1\C\;

 

Note also that all the subfolders will not be checked either. If you have set-up this option, and need to do a syntax check in one of the files under the paths selected, you will need to do it manually (read below).

 

icon_exclaim When perl syntax checks scripts, it actually executes parts of the used modules of the script, and also BEGIN and CHECK blocks. For most cases this is OK; however if for some reason you do not want this to happen, then check the option Run / Syntax checking only in script. Note though that you might get errors complaing about barewords not being allowed.

 

icon_exclaim In some rare cases, automatic syntax checking should not be called while editing. If you are editing a script like this, you can manually disable checking for the specific script by disabling the menu item "Run / Automatic syntax checking". This item is per script; it's value is saved if needed for the file if it's contained in a project.

 

 

Testing for syntax errors and warnings

 

In OptiPerl you can test your script for compilation errors and warnings using two methods by selecting Run / Syntax check or Expanded Syntax Check. Both will check your script for errors or warnings and report the results in a separate window.

 

  • Syntax check outputs results identical to running perl with a -c switch.
  • Expanded syntax check will also evaluate first required modules in your script. This is useful if you are using required modules that declare a variable, and in the script you get false warnings of "used only once".

 

The Status Window is brought up docked to the main editor. By double clicking each line, you can go to the offending line. If you used the expanded syntax check, you might also get errors and warnings in required modules, which optiperl will load first before going to the line.

 

icon_idea In the Options under "Perl" you can select the level of warnings (None,Useful,All).

 

 

 

Top  Previous  Next