Activator
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/SecureCookies.pm view on Meta::CPAN
convert a get string ( key1=val1&key2=val2 ) to a hash representing a
web form. If you are really using a get string, you must be sure to
only pass in the text after the question mark.
Args:
$url_encoded - parse this text
Return:
$form - hashref of the variables
=cut
sub _url_decode_hashref {
my ($url_encoded) = @_;
my %form;
foreach (split(/&/,$url_encoded)) {
## convert plus's to spaces
s/\+/ /g;
## split into key and value.
my ($key, $val) = split(/\=/,$_,2 );
## convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge if $key;
$val =~ s/%(..)/pack("c",hex($1))/ge if $val;
## associate key and value, multiple vars get tab delimination
$form{$key} .= "\t" if ( defined($form{$key}) );
$form{$key} .= $val if ( defined($val) );
}
return \%form;
}
=item B<_urlencode_string>
Description:
convert $string into a url safe format
=cut
sub _urlencode_string {
my ($string) = @_;
## standard urlencode
$string =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
$string =~ s/ /\+/g;
return $string;
}
=back
=head1 SEE ALSO
L<Catalyst>, L<Digest::SHA1>, L<Crypt::CBC>, L<MIME::Base64>
L<http://www.schneier.com/blog/archives/2005/08/new_cryptanalyt.html>
=head1 AUTHOR
Rob Johnson L<rob@giant-rock.com>
=head1 ACKNOWLEDGEMENTS
* Karim A. Nassar for converting this into a self-contained Catalyst Plugin.
* All the helpful people in #catalyst.
=head1 COPYRIGHT
Copyright (c) 2007 Karim A. Nassar <karim.nassar@acm.org>
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file.
=cut
1;
( run in 1.578 second using v1.01-cache-2.11-cpan-437f7b0c052 )