dump POST data to screen

Discussion in 'Perl Misc' started by henribaeyens, Feb 15, 2008.

  1. henribaeyens

    henribaeyens Guest

    Hello,

    I'm trying to figure out a way to output, for debugging purposes, the
    contents of a multipart form-data. The posted data consists of both text
    type inputs and file types input. In php, one can invoke print_r($_POST)
    and print_r($_FILES), how do I achieve this using perl, especially for
    the $_FILES data; I can do the $_POST by parsing the query string but how
    do I do it for the files?

    Thanks much for any help

    Henri
     
    henribaeyens, Feb 15, 2008
    #1
    1. Advertising

  2. henribaeyens wrote:
    > I'm trying to figure out a way to output, for debugging purposes, the
    > contents of a multipart form-data.


    print <STDIN>;

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Feb 15, 2008
    #2
    1. Advertising

  3. henribaeyens

    henribaeyens Guest

    On Fri, 15 Feb 2008 18:16:38 +0100, Gunnar Hjalmarsson wrote:

    > henribaeyens wrote:
    >> I'm trying to figure out a way to output, for debugging purposes, the
    >> contents of a multipart form-data.

    >
    > print <STDIN>;


    nice guru shit!

    I managed to come up with

    while(<STDIN>) {
    chomp($_);
    print "$_<br>\n";
    }

    thanks
     
    henribaeyens, Feb 15, 2008
    #3
  4. henribaeyens wrote:
    > On Fri, 15 Feb 2008 18:16:38 +0100, Gunnar Hjalmarsson wrote:
    >> henribaeyens wrote:
    >>> I'm trying to figure out a way to output, for debugging purposes, the
    >>> contents of a multipart form-data.

    >>
    >> print <STDIN>;

    >
    > nice guru shit!
    >
    > I managed to come up with
    >
    > while(<STDIN>) {
    > chomp($_);
    > print "$_<br>\n";
    > }


    You didn't mention that you are using a CGI script to inspect the data.
    It's not advisable to display unparsed form data as HTML. If you are
    using a browser, try this instead:

    print "Content-type: text/plain\n\n", <STDIN>;

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Feb 15, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russell
    Replies:
    1
    Views:
    378
    Steve C. Orr [MVP, MCSD]
    Jan 21, 2004
  2. halfdog
    Replies:
    12
    Views:
    12,471
  3. Pat
    Replies:
    5
    Views:
    543
  4. owl
    Replies:
    2
    Views:
    882
  5. peter

    post-mortem from core dump

    peter, Jun 9, 2008, in forum: Python
    Replies:
    1
    Views:
    318
    peter
    Jun 10, 2008
Loading...

Share This Page