CGI::Easy::Util - low-level helpers for HTTP/CGI
This document describes CGI::Easy::Util version v2.0.0
use CGI::Easy::Util qw( date_http date_cookie make_cookie ); my $mtime = (stat '/some/file')[9]; printf "Last-Modified: %s\r\n", date_http($mtime); printf "Set-Cookie: a=5; expires=%s\r\n", date_cookie(time+86400); printf make_cookie({ name=>'a', value=>5, expires=>time+86400 }); use CGI::Easy::Util qw( uri_unescape_plus burst_urlencoded burst_multipart ); my $s = uri_unescape_plus('a+b%20c'); # $s is 'a b c' my %param = %{ burst_urlencoded($ENV{QUERY_STRING}) }; my $a = $param{a}[0]; ($params, $filenames, $mimetypes) = burst_multipart($STDIN_data, $1) if $ENV{CONTENT_TYPE} =~ m/;\s+boundary=(.*)/xms; my $avatar_image = $params->{avatar}[0]; my $avatar_filename = $filenames->{avatar}[0]; my $avatar_mimetype = $mimetypes->{avatar}[0];
This module contain low-level function which you usually doesn't need - use CGI::Easy::Request and CGI::Easy::Headers instead.
Nothing by default, but all documented functions can be explicitly imported.
Convert given time into text format suitable for sending in HTTP headers.
Return date string.
Convert given time into text format suitable for sending in HTTP header Set-Cookie's "expires" option.
Convert HASHREF with cookie properties to "Set-Cookie: ..." HTTP header.
Possible keys in %cookie:
name REQUIRED STRING value OPTIONAL STRING (default "") domain OPTIONAL STRING (default "") path OPTIONAL STRING (default "/") expires OPTIONAL STRING or SECONDS secure OPTIONAL BOOL
Format for "expires" should be either correct date 'Thu, 01-Jan-1970 00:00:00 GMT' or time in seconds.
Return HTTP header string.
Same as uri_unescape from URI::Escape but additionally replace '+' with space.
Return unescaped string.
Unpack name/value pairs from url-encoded string (like $ENV{QUERY_STRING} or STDIN content for non-multipart forms sent using POST method).
Return HASHREF with params, each param's value will be ARRAYREF (because there can be more than one value for any parameter in source string).
Unpack buffer with name/value pairs in multipart/form-data format. This format usually used to upload files from forms, and each name/value pair may additionally contain 'file name' and 'mime type' properties.
Return three HASHREF (with param's values, with param's file names, and with param's mime types), all values in all three HASHREF are ARRAYREF (because there can be more than one value for any parameter in source string). For non-file-upload parameters corresponding values in last two hashes (with file names and mime types) will be undef().
Please report any bugs or feature requests through the issue tracker at https://github.com/powerman/perl-CGI-Easy/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license. Feel free to fork the repository and submit pull requests.
https://github.com/powerman/perl-CGI-Easy
git clone https://github.com/powerman/perl-CGI-Easy.git
MetaCPAN Search
https://metacpan.org/search?q=CGI-Easy
CPAN Ratings
http://cpanratings.perl.org/dist/CGI-Easy
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/CGI-Easy
CPAN Testers Matrix
http://matrix.cpantesters.org/?dist=CGI-Easy
CPANTS: A CPAN Testing Service (Kwalitee)
http://cpants.cpanauthors.org/dist/CGI-Easy
Alex Efros <powerman@cpan.org>
This software is Copyright (c) 2009-2010 by Alex Efros <powerman@cpan.org>.
This module also include some code derived from
by Benjamin Franz <snowhare@nihongo.org>. Copyright (c) Benjamin Franz. All rights reserved.
This is free software, licensed under:
The MIT (X11) License
To install CGI::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Easy
CPAN shell
perl -MCPAN -e shell install CGI::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.