Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

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


in reply to CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?

If CGI.pm is deprecated, then what is better solution that is as simple as CGI.pm?

The idea is not to get rid of CGI.pm per se, it's to get rid of multi-entrypoint (per-file) CGI-based architectures, instead having (1) all routes in more or less once place, making it much harder to leave sensitive endpoint not protected by a requirement to authorize and (2) template-based page rendering as opposed to print "<html>", ... mixed with domain-specific logic, which some CGI.pm-based scripts are famous for.

So if you want to have a single script to be called by your web-server using the CGI protocol, you can still use CGI.pm, but please also consider templates. See also: XY problem. What are you trying to build using this CGI script?

  • Comment on Re: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: CGI.pm not good practice, so what is good, modern, practice for reading CGI paramters?
by haukex (Bishop) on May 24, 2021 at 15:43 UTC
    The idea is not to get rid of CGI.pm per se

    It partly is, though. While your points about CGI application architecture in general are valid, I think they also miss the reasons why CGI.pm specifically is no longer recommended. See "CGI.pm Has Been Removed From the Perl Core" in CGI.pm and the section "HTML Generation functions should no longer be used" right below that, as well as all the links therein to the various discussions. IMHO, one of the things CGI.pm suffers from is having to drag around backward-compatible features (like ISINDEX support, just to name another one).

    Old-style CGI scripts sometimes still can be useful, but I certainly advocate for modern frameworks as well, especially if the application grows beyond one or two scripts.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-21 04:49 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?