5

I have to work on a file that for a variety of reasons cannot be renamed to have a .pl extension. So far I have worked by creating a private version, changing its name to have a .pl extension and then copying it back again after changes. It is now becoming cumbersome and creating bugs. Is there any way to make perl epic/eclipse syntax color a .pl file

doon
  • 2,181
  • 6
  • 30
  • 46

3 Answers3

6

To associate a file extension with Epic Perl in Eclipse go to: Window > Preferences > General > Editors > File Associations.

If you see the extension that you're looking for listed under "File types:" skip to step 2.

Step 1: To the right of the "File types:" box click Add. Now type * followed by the extension name. For example, to add .txt I type *.txt then click OK.

Step 2: Click on the extension in the "File types:" box. Then, to the right of the "Associated editors:" box click Add. Now select Epic Perl Editor and click OK. Lastly, select Epic Perl Editor in the "Associated editors:" box and click Default.

Now your files of that type should be treated as if they were .pl files by the Epic Perl syntax.

Joe
  • 61
  • 3
3

I have some Perl files which even haven't got any extension. What I did is to use "ln" setup a symbol link with .pl to point the real file.

Yang
  • 1,067
  • 1
  • 9
  • 13
2

You should be able to right click on the file and select "open with", but I don't know if you can make that permanent.

One way that worked for me as a permanent fix is almost the same as what @Joe answered above, but it does not require an extension. Apparently this is feature request #39 for epic and has been a problem for almost 10 years. The file association mechanism uses wild-cards to specify all files with a given extension, but you don't need to use that. You can just enter the full name for the file and have it associated directly with the epic perl source code editor.

If the file I want to be perl is called my-perl-executable-name, on my mac the sequence is:

  1. Select the preference pane for Content types:

    [Menu] Eclipse -> Preferences ->
    [Tree] General -> Content Types -> [Pane] Content Types

  2. In the Content types pane, select the Perl Source File type:

    [Tree] Text -> Perl Source File

  3. In the File associations part of the pane add the name of your executable to the list.

    [button] (click) Add…
    [Dialog]-> Content Type text box -> (type) my-perl-executable-name
    [Dialog]-> [button] (click) OK
    [Pane]-> [button] (click) OK

  4. Close and reopen the file my-perl-executable-name. It should now be syntax-highlighted.

Note: This solution may not work if your specific file name already has an "Assigned Content Type", especially if it contains an extension (i.e. my-executable.txt is not a good executable name).

Stuart R. Jefferys
  • 913
  • 1
  • 12
  • 21