On Thu Oct 12 05:25:19 2006, SREZIC wrote:
Show quoted text> On Thu Oct 12 05:21:58 2006, SREZIC wrote:
> > On Thu Oct 12 05:14:40 2006, SREZIC wrote:
> > > The CGI Pod states that the default enctype parameter of start_form is
> > > "application/x-www-form-urlencoded". This does not seem to be true:
> > >
> > > $ perl -MCGI=:standard -le 'print start_form'
> > > <form method="post" action="
http://localhost"
> > enctype="multipart/form-data">
> > >
> >
> > Funny enough using startform (without an underline), will use the other
> > default:
> >
> > $ perl -MCGI=:standard -le 'print startform'
> > <form method="post" action="
http://localhost"
> > enctype="application/x-www-form-urlencoded">
> >
>
>
> And another startform/start_form anomaly: if using three arguments to
> the function, then it behaves different:
>
> $ perl -MCGI=:standard -le 'print startform("GET", "/login",
> &CGI::URL_ENCODED)'
> <form method="get" action="/login"
> enctype="application/x-www-form-urlencoded">
>
> $ perl -MCGI=:standard -le 'print start_form("GET", "/login",
> &CGI::URL_ENCODED)'
> <form method="get" action="/login" enctype="multipart/form-data"
> application/x-www-form-urlencoded>
>
> (The latter being completely broken).
I've confirmed all issues to still be open with 3.43. To shed some light
on it: startform() was the original method, and later "start_form() was
added to supercede it, and apparently intended to have a better/smarter
default enc type. It is is implemented like this:
sub start_form { $XHTML ? &start_multipart_form : &startform; }
The "completely broken" behavior shown last is really part of the normal
handling of the HTML generators: It is trying to turn extra arguments
into name/value attributes for the tag.
It's not crystal clear to me the best way to resolve the mess. I think
the best suggestion I have now is to make sure the docs refer to only
"start_form() nearly everywhere, and document how it is intended to be
used. Then just in one less visible place, we can document startform()
as a historical method, which unfortunately has a slightly different
behavior.
Yes, it would be ideal if the worked the same, but I think we perhaps
should leave the old startform() alone for backwards compatibility, the
behavior of the newer start_form() is I think intentionally meant to be
an improvement.
Mark