Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to add Perl support for Adobe Dreamweaver CS5 and the .cgi extension with color coding and syntax highlighting

Published on
16,537 Points
Last Modified:
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.

And here are the steps to make it happen:
Get the official Dreamweaver Extension for Perl Support (by ChrisBanks) from:
http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1021086 Download, install, then restart Dreamweaver. You need to restart Dreamweaver anytime a new extension is added in order for it to work.
Open Windows Explorer to the following directory:
C:\Users\{YOUR_USER_NAME_GOES_HERE}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\DocumentTypes\
OR from the "Run..." prompt:
C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\DocumentTypes\PerlDocumentType.xml )
Find the file name PerlDocumentType.xml, and open it with a text editor.
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.

In the 3rd line of the file find the following:
<documenttype id="Perl" internaltype="Text" winfileextension="pl,pm" macfileextension="pl,pm" file="Default.pl" writebyteordermark="false">
And change it to:
<documenttype id="Perl" internaltype="Text" winfileextension="pl,pm,cgi" macfileextension="pl,pm,cgi" file="Default.pl" writebyteordermark="false">
Finally, use the Windows Explorer and go to: C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration
To use the Run... prompt:
C:\Users\{YOUR_USER_NAME}\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configuration\Extensions.txt
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!
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Join & Write a Comment

In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month