logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

CGI::Struct::XS - Build structures from CGI data. Fast.

Description

       This module is XS implementation of CGI::Struct.  It's fully compatible with CGI::Struct, except for
       error messages.  "CGI::Struct::XS" is 3-15 (5-25 with dclone disabled) times faster than original module.

Functions

build_cgi_struct
         $struct = build_cgi_struct \%params;

         $struct = build_cgi_struct \%params, \@errs;

         $struct = build_cgi_struct \%params, \@errs, \%conf;

       The only exported function is "build_cgi_struct".  It has three arguments:

       "\%params"
           HashRef with input values. Typicaly this is CGI or Plack params hashref

       "\@errs"
           ArrayRef  to  store  error  messages.   If  it's  not  defined  all  parsing errors will be sielently
           discarded.

       "\%conf"
           HashRef with parsing optiosn

       Following options are supported:

       "nodot"
           Treat dot as ordinary character, not hash delimeter

       "nullsplit"
           Split input values by "\\0" character, useful for old CGI libraries

       "dclone"
           Store deep clone of value, instead of original value.  This  opion  increase  memory  consumsion  and
           slows parsing.  It's recomended to disable dclone, because in most cases CGI params are used as read-
           only variables.

Name

       CGI::Struct::XS - Build structures from CGI data. Fast.

See Also

       CGI::Struct

perl v5.40.0                                       2024-10-20                               CGI::Struct::XS(3pm)

Synopsis

         use CGI;
         use CGI::Struct::XS;
         my $cgi = CGI->new;
         my %params = $cgi->Vars;
         my $struct = build_cgi_struct \%params;
         ...

       Or

         use Plack::Request;
         use CGI::Struct::XS;

         my $app_or_middleware = sub {
             my $env = shift; # PSGI env
             my $req = Plack::Request->new($env);
             my $errs = [];
             my $struct = build_cgi_struct $req->parameters, $errs, { dclone => 0 };
             ...
         }

See Also