Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Reading Raw data in CGI::Application

by derby (Abbot)
on Jan 04, 2007 at 19:16 UTC ( #593003=note: print w/replies, xml ) Need Help??


in reply to Reading Raw data in CGI::Application

That's a feature of CGI - it's treating your post data as an ISINDEX script. Definitely not something you want to rely on:

#!/usr/local/bin/perl use strict; use warnings; use CGI; use Data::Dumper; my $cgi = CGI->new( '{ "Image": { "Width": 800, "Height": 600, "Title": "View from 15th Floor", "Thumbnail": { "Url": "http://www.example.com/image/481989943", "Height": 125, "Width": "100" }, "IDs": [116, 943, 234, 38793] } }' ); print Dumper( $cgi ); $cgi = CGI->new( '{ "Image": { "Width=": 800, "Height": 600, "Title": "View from 15th Floor", "Thumbnail": { "Url": "http://www.example.com/image/481989943", "Height": 125, "Width": "100" }, "IDs": [116, 943, 234, 38793] } }' ); print Dumper( $cgi );
The first dump will show you the JSON data associated with the keyword param. The second dump will show you the hilarity that will ensue if there's an equal signs somewhere in your data.

Your best bet is to provide a cgi_get_query method that deals with the data how you want to deal with it (as outlined in the docs for CGI::Application).

-derby

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://593003]
help
Chatterbox?
[choroba]: someone told me to use perl instead of sed for something, and several years later, I'm developing a huge Tk application
[Discipulus]: choroba started in primary school to get some advantage in the future..
[choroba]: nono, I programmed in Basic at the primary school, on my Commodore 116/16
[Discipulus]: ;=)
[choroba]: then learned some assebly on the same machine, then moved to my father's PC (XT with a Hercules card), used Turbo Pascal a lot
[choroba]: I started with *nix at the University, we had some Sparcs and Linux machines
[choroba]: that was around 1994 or 95
hippo actually introduced Linux to his university.
Discipulus mmh will be a fun meditation: How I started with computers and programming..
[Discipulus]: bravo hippo! well done

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2018-06-22 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (123 votes). Check out past polls.

    Notices?