Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?

by Anonymous Monk
on May 24, 2021 at 19:18 UTC ( #11132988=note: print w/replies, xml ) Need Help??


in reply to Re^2: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?
in thread CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^3: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?
  • Download Code

Replies are listed 'Best First'.
Re^4: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?
by dsheroh (Monsignor) on May 25, 2021 at 07:25 UTC
    "What's the recommended way to receive HTTP input on multiple channels, while abstracting away which channel(s) was used?" is, itself, a perfectly good question.

    I have no idea why you're so hellbent on painting this as an XY problem. The OP needs to receive input. The OP is used to receiving it via CGI.pm. The OP understands that CGI.pm is deprecated and wants to know the current, non-deprecated alternative which comes closest to working in the same way.

    None of that is application-dependent, nor does it suggest that there's a "real question" behind the question of "how do I accept user input?".

      Sorry for not replying promptly. I was out of work for a few days.

      Yes -- my problem is "What's the recommended way to receive HTTP input on multiple channels, while abstracting away which channel(s) was used?".

      My CGI script is tiny, has one entry point, it's not a full service, not a big application.

      Preferred way would be:

      #!/usr/bin/perl use CGI:Somesolution qw(getAllInputAsHash); # user input, decoded from UTF my $userinput = getAllInputAsHash({decodeUtf => 1});

      I keep using CGI.pm like this:

      #!/usr/bin/perl use CGI; use Encode; my $cgi = CGI->new; sub decodedForSomeTypes { $ENV{CONTENT_TYPE} =~ /boundary/ ? $_[0] : decode_utf8($_[0]); } my $params = +{ map { $_ => decodedForSomeTypes(scalar $cgi->param($_)) } $cgi->pa +ram() };

        Since you mention Unicode: Just the other day I became aware of the new CGI::Tiny, which seems to place emphasis on Unicode.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-01-21 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?