Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Yet Another CGI question

by Apterigo (Scribe)
on Jun 15, 2000 at 00:03 UTC ( #18169=perlquestion: print w/replies, xml ) Need Help??

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

When I write CGI scripts, and try to run them from either windows or a unix shell, I get a message that says:

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

I want to see the html that is going to be generated, is their a way I can do that?

Thanks,
Apterigo

Replies are listed 'Best First'.
Re: Yet Another CGI question
by lhoward (Vicar) on Jun 15, 2000 at 00:10 UTC
    Well, if you don't want to enter any of the CGI name/value pairs just hit CONTROL-D. If you do want, enter the pairs, one on a line, then hit CONTROL-D.
      On Windows, it's Ctrl-Z. In both cases, enter it at the start of a line. That sends the program "end of file", ending the read, and you can all move on with your lives.
        And if the HTML is too long for you to look at on the screen, you can either pipe it into less (or favorite pager), or on a windows machine, redirect the output to a file.
        perl foo.pl | less or perl foo.pl > foo.htm
        With the second method, you can pull up a browser and check out what it looks like also.

        #!/home/bbq/bin/perl
        # Trust no1!
(jcwren) RE: Yet Another CGI question
by jcwren (Prior) on Jun 15, 2000 at 00:18 UTC
    Or, change your 'use' statement to:
    use CGI qw/:standard -no_debug/;
    and you won't be prompted. This is useful if your script will be parsing/generating HTML but won't be invoked through the webserver.

    --Chris
Re: Yet Another CGI question
by Odud (Pilgrim) on Jun 15, 2000 at 00:23 UTC
    Or enter some dummy params as in
    $query = new CGI('dinosaur=barney&color=purple');
Re: Yet Another CGI question
by plaid (Chaplain) on Jun 15, 2000 at 00:12 UTC
    cntl-D for unix variants, and I believe cntl-Z for Windows.
RE: Yet Another CGI question
by le (Friar) on Jun 15, 2000 at 00:11 UTC
    It's not a bug, it's a feature:
    Just like passing variables via GET or POST, you have to give varibles like 'foo=bar'. Just hit Ctrl-D one or more times (depends on how many parameters it expects), then your script finishes.
Re: Yet Another CGI question
by husker (Chaplain) on Jun 15, 2000 at 23:58 UTC
    another way is just to pass some dummy params in on your command line:
    $ mycgi.pl m=m
    satisfies the Perl interpreter, without worrying about pressing CTRL keys or anything like that. Handy if you are wanting to test inside a standard shell script or batch file.
Re: Yet Another CGI question
by chromatic (Archbishop) on Jun 15, 2000 at 00:11 UTC
    You can hit CTRL-D (or whatever the appopriate combination is for end-of-input on Windows) to simulate a query-string. You can also redirect data from a file or from echo to the program (through standard input).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://18169]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2022-08-16 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?