CGI::Struct::XS(3pm)

NAME
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.

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 };
      ...
  }

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.

SEE ALSO
CGI::Struct