And yes, CGI imports escape and unescape from CGI::Utils but perldoc
CGI::Utils says:
> DESCRIPTION: no public subroutines
So I guess using CGI::escape and CGI::unescape amounts to using
undocumented features of CGI.
In light of that, I suggest the answer to the FAQ to be misleading. At
least I have no idea how to "decode or create those %-encodings on the
web" from reading perldoc CGI.
I suggest one of:
* Document escape and unescape in perldoc CGI (please, please,
please!)
* Elaborate on how this escaping and unescaping can be achieved using
only the documented interface
In any event, I find the FAQ answer is not currently useful as far as
CGI goes.
Peter
In article
<f6bd282d-ddd2-4709...@j4g2000yqh.googlegroups.com>,
Peter Valdemar M�rch <4ux6...@sneakemail.com> wrote:
> I suggest one of:
> * Document escape and unescape in perldoc CGI (please, please,
> please!)
> * Elaborate on how this escaping and unescaping can be achieved using
> only the documented interface
Patches welcome :)
CC: Lincoln D. Stein, author of CGI.pm
Yeah, as soon as I hit "Send" I realized that was a very probable
repsonse :-) Ok, so here goes. Also available at http://pastebin.com/bPRq0Nsj
in case Google Groups mangles or does line wrapping:
--- orig.CGI.pm 2010-01-29 15:41:54.000000000 +0100
+++ CGI.pm 2010-06-28 08:56:49.000000000 +0200
@@ -255,6 +255,7 @@
':html' => [qw/:html2 :html3 :html4 :netscape/],
':standard' => [qw/:html2 :html3 :html4 :form :cgi/],
':push' => [qw/multipart_init multipart_start multipart_end
multipart_final/],
+ ':escape' => [qw/escape unescape/],
':all' =>
[qw/:html2 :html3 :netscape :form :cgi :internal :html4/]
);
@@ -4878,6 +4879,10 @@
Import all HTML-generating shortcuts (i.e. 'html2', 'html3', 'html4'
and 'netscape')
+=item B<:escape>
+
+Import the escape and unescape methods
+
=item B<:standard>
Import "standard" features, 'html2', 'html3', 'html4', 'form' and
'cgi'.
@@ -5698,6 +5703,20 @@
),
hr;
+=head2 ESCAPING/ENCODING AND UNESCAPING/DECODING URL STRINGS
+
+URL parameters are encoded in what is also known as Percent-encoding
+L<http://en.wikipedia.org/wiki/Percent-encoding>
+
+ use CGI ':escape';
+ my $string = "Hello World";
+ my $escaped = escape($string);
+ print $escaped, "\n";
+ die "How could unescape(escape($string)) ne $string"
+ unless unescape($escaped) eq $string;
+
+prints out "Hello%20World"
+
=head2 PROVIDING ARGUMENTS TO HTML SHORTCUTS
The HTML methods will accept zero, one or multiple arguments. If you
Peter
CC: Lincoln D. Stein, author of CGI.pm
In article
<0bf7e3ae-a65d-4718...@s9g2000yqd.googlegroups.com>,
Peter Valdemar M�rch <pmo...@gmail.com> wrote:
> On Jun 27, 4:27�am, brian.d....@gmail.com (brian d foy) wrote:
> > > I suggest one of:
> > > * Document escape and unescape in perldoc CGI (please, please,
> > > please!)
> > > * Elaborate on how this escaping and unescaping can be achieved using
> > > only the documented interface
> >
> > Patches welcome :)
>
> CC: Lincoln D. Stein, author of CGI.pm
If you are making patches to modules, you should probably post them to
their RT queue (or whatever issue tracking they use). As far as I know,
Lincoln has passed on maintainership of CGI.pm so sending patches to
him is not a good way to get the right people to notice them.
Note that sending any patches to personal email or unrelated mailing
lists is probably the best way to have them ignored. :)
From perldoc CGI (e.g. http://perldoc.perl.org/CGI.html):
> Address bug reports and comments to: lst...@cshl.org.
:-(
Peter
You can always CC authors, but always get it into something that other
people can see. That's why we have RT. Out of date docs can't be
trusted to tell you what to do. :)
Ok, so I created:
https://rt.cpan.org/Public/Bug/Display.html?id=59077
:-)