kmullin has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to 'fake out' CGI.pm? I have a module that os using CGI.pm, but I want to run it from a command line, not from a web browser, just to see the HTML that it produces in a test mode. Is this possible?

Replies are listed 'Best First'.
Re: faking out CGI.pm
by Joost (Canon) on Dec 19, 2007 at 20:30 UTC

      Cool, I'll try that.

Re: faking out CGI.pm
by thezip (Vicar) on Dec 19, 2007 at 23:52 UTC
    To expand on Joost's suggestion, you could create a file containing the pre-specified NAME=VALUE pairs.
    __DATA__ foo_field=foo's_value bar_field=bar's_value ...
    Then, it's just a matter of getting a filehandle and instantiating a CGI object with it:
    open(IFH, $CGI_filename) || die ... my $query = CGI->new(IFH); my $field = $query->param('foo_field'); print $field, "\n"; __OUTPUT__ foo's_value

    Your wish is my commandline.
Re: faking out CGI.pm
by nikosv (Deacon) on Dec 22, 2007 at 12:44 UTC

    If you are on windows check Komodo and Openkomodo IDE from Activestate.

    It's product overview states : 'CGI emulation Full environment control while debugging web applications on your local machine'

    also check komodo-35-for-dynamic-languages

A reply falls below the community's threshold of quality. You may see it by logging in.