13.7. cgi-test

Let's add to our black bag the following script:

#!/usr/bin/perl -Tw
use strict;
print "Content-type: text/plain\n\n";
print "$_: $ENV{$_}\n" for sort keys %ENV;
print "\nInput:\n";
print <STDIN>;

Use this whenever you have doubts about what a form is really sending to the server. Just make this script the target of the form action, and you'll get a terse dump of the environment variables and any content that the form sent via POST.

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.