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

Hi Monks,

I'd be grateful if someone could enlighten me, a humble newb. The purpose of my this script is to allow the user to add notes to a bunch of entries in a text-file. I'd like to pass a bunch of different variables to a perl/CGI script but I don't know the names of the variables (they are read from the text file). In the past, I've done this sort of thing using METHOD=GET and simply read/parsed the variables and values from the URL, but in this case I want to pass a considerable amount of text to the script (too much to go through the URL) so I'm not sure what to do. Since I don't know the names of the variables, I can't use the CGI param function as usual.

From what I've read here and elsewhere, I can use a read(STDIN) sort of thing, but that this is not compatible with CGI.pm. How to I get around this? I want to be able to read all of the POST data without knowing variable-names in advance. And I'd like to continue using CGI.pm, if possible. Help?


Thanks very much and humble apologies if this was posted elsewhere. I saw similar posts, but no answers to this precise question...

Replies are listed 'Best First'.
Re: CGI.pm & STDIN question
by GrandFather (Saint) on Oct 21, 2008 at 02:11 UTC

    In the section of the CGI documentation headed "FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR SCRIPT" it provides the sample code:

    @names = $query->param

    Perl reduces RSI - it saves typing