Edit Perl Files in Dreamweaver (with color syntax highlighting)

Get the Perl / CGI Dreamweaver Extension

Edit PERL and CGI files in Dreamweaver with color colding and syntax highlighting. Didn’t think it was possible? Well, it is.

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to do it in a way that would support DreamWeaver’s color coding and syntax highlighting as well. I also wanted to be able to open files with a .cgi extension by double-clicking on the file rather than launching Dreamweaver, searching for the file, etc.

First, a little background for the youngsters: Before PHP and ASP became popular, Web developers used the Common Gateway Interface (CGI) to process forms and such. A URL was used to point to a CGI script on the server (usually in the cgi-bin folder) and the form could be processed. The CGI script could be built in any of several languages, the most common being Perl. And a great way to simplify everything was to name all CGI scripts with the .cgi extension. In this way you could configure your webserver to treat all files with a .cgi extension as CGI scripts.

The first step was to find out how DreamWeaver decides which file extensions are supported. I scoured the internet for information on how to add file extensions to the DreamWeaver program. After several hours of searching I finally came up with a way to achieve our goal!

You will need to edit two files to add the .cgi extension with the full capabilities of Dreamweaver CS3, 4, 5, and beyond. These two files are an .xml file and a .txt file. Remember that Windows hides known file extensions so you may have to change your settings to make sure you grab the right files. I did not try this on a Mac but I assume the files are named the same. There are lines in the files that allow for enabling these features on a Macintosh, so I think this will work for Mac, you will just have to find the files in the directory they install in the Mac OS.

The first step is to get the official Dreamweaver Extension for Perl Support (by ChrisBanks) from:
Perl Support (local mirror)
Download, install, then restart Dreamweaver. You need to restart Dreamweaver anytime a new extension is added in order for it to work.

Make it work with CGI to get it to work with CGI files, a few minor tweaks are needed Install the extension mentioned above. Then, make the following changes in these two files:

File 1: PerlDocumentType.xml
Open Windows Explorer to the following directory:
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver 9\Configuration\DocumentTypes\PerlDocumentType.xml (on Windows)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS4\Configuration\DocumentTypes\PerlDocumentType.xml (on Windows for Dreamweaver CS4)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS5\Configuration\DocumentTypes\PerlDocumentType.xml (on Windows for Dreamweaver CS5)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS6\Configuration\DocumentTypes\PerlDocumentType.xml (on Windows for Dreamweaver CS6)
/Users//Library/Application Support/Adobe/Dreamweaver CS4/en_US/Configuration/DocumentTypes/PerlDocumentType.xml (on OS X for Dreamweaver CS4)
/Users//Library/Application Support/Adobe/Dreamweaver CS5/en_US/Configuration/DocumentTypes/PerlDocumentType.xml (on OS X for Dreamweaver CS5)
/Users//Library/Application Support/Adobe/Dreamweaver CS6/en_US/Configuration/DocumentTypes/PerlDocumentType.xml (on OS X for Dreamweaver CS6)

Find the file name PerlDocumentType.xml, and open it with a text editor. In the 3rd line of the file find the following:

And change it to:

NOTE: If you properly installed the Perl Support Extension above, you will see the file. If not, search for it by the name or try to reinstall the Perl extension.

File 2: Extensions.txt
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver 9\Configuration\Extensions.txt (on Windows)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS4\Configuration\Extensions.txt (on Windows for Dreamweaver CS4)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS5\Configuration\Extensions.txt (on Windows for Dreamweaver CS5)
C:\Documents and Settings\%username%\Application Data\Adobe\Dreamweaver CS6\Configuration\Extensions.txt (on Windows for Dreamweaver CS6)
/Users//Library/Application Support/Adobe/Dreamweaver CS4/en_US/Configuration/Extensions.txt (on OS X for Dreamweaver CS4)
/Users//Library/Application Support/Adobe/Dreamweaver CS5/en_US/Configuration/Extensions.txt (on OS X for Dreamweaver CS5)
/Users//Library/Application Support/Adobe/Dreamweaver CS6/en_US/Configuration/Extensions.txt (on OS X for Dreamweaver CS6)

Find the file with the name Extensions.txt there. If you properly install the DW Extension for Perl Support, the last line of the file will be:
PL,PM:Perl files
change it to:
PL,PM,CGI:Perl files

Save the file. Close Dreamweaver, and re-open it. Try it out!

Problem Solved! Screenshot:

dreamweaver  CodeColoring.xml perl
dreamweaver CodeColoring.xml perl