Of course you will need Perl.

To create images in Perl you need to use gd & gd for Perl.

You will need some mailing program such as sendmail and some file encoding program such as uuencode. Both of which should be installed on a standard UNIX machine.

Install the script to your cgi-bin directory with the file permissions set to 755.
chmod 755 signaturetest.cgi

In the Perl script there are a few parameters that can be adjusted to suite your sites needs. The # symbol is for comments. Anything on that line will be ignored. For the library path, you may need to uncomment that line and set a path such as:
use lib "/lib/gd"';

# Set to the path for location libraries.
#use lib " ";

# Filename for the image.
$FILENAME="signature.jpg";

# Your mail program.
$MAILPROG="/usr/lib/sendmail";

# Your encode program.
$ENCODE="/usr/bin/uuencode";

# Date program.
$DATE="/sbin/date";

# Default Subject.
$SUBJECT_DEFAULT="Signature";

# Default Filename.
$FILENAME_DEFAULT="signature.jpg";

# Allowed referers. Set this to your site's name and IP. Include a list of various
# sites you which to allow access to the script.
@referers = ('www.com','0.0.0.0');