CGI::Struct::XS(3pm)

CGI::Struct::XS3pm

Build structures from cgi data. fast.

Usage

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

Overview

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.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcgi-struct-xs-perl 1.04-3+b4 in Debian 13 (Trixie). Parsed by carta from the page's man source.