CGI::URL_ENCODED

毎回、enctypeに'application/x-www-form-urlencoded'と打つのも大変なので、大抵は指定する時にCGI::URL_ENCODEDという定数を使う。

https://pointoht.ti-da.net/e6734582.html

(正確にはサブルーチンなのか・・・。)
action.cgiを、

こうする。
perlコマンドで確認。

$ vi action.cgi
$ perl action.cgi
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>CGI::URL_ENCODED</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form method="post" action="http://localhost" enctype="application/x-www-form-urlencoded">
<input name="key1" value="value1">
<input name="key2" value="value2">
<input type="submit" value="submit">
</form>
</body>
</html>$
$

enctype="application/x-www-form-urlencoded"が出力されてるので、CGIでの確認は省略。

Sample/perl/CGI/URL_ENCODED/src/CGI at master · bg1bgst333/Sample · GitHub