13.10. Command Line Testing

A CGI.pm program is easily tested from the command line; as soon as the program calls a CGI method or creates a CGI object it will prompt

(offline mode: enter name=value pairs on standard input)

and you can then type a series of lines like:

address="742 Evergreen Terrace"
phone=555-8707

End them with whatever character signals end-of-input to your current shell. The inputs you cannot provide this way are

  • File uploads.

  • Cookies: You can pass them by setting the environment variable HTTP_COOKIE to the name of the cookie followed by an = sign and the value of the cookie.

  • User authentication: Set the REMOTE_USER environment variable to the name of the authenticated user. A Web server will not pass the password the user ...

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.