NAME

CGI::PersistentParams - make query parameters persist between pages

SYNOPSIS

  # Take query from CGI.pm
  my $q = CGI::PersistentParams->new(
    discard => [qw[action pass user]]
  );

  # Explicitly set a parameter
  $q->param( template => 'foo' );
  $q->param( page => 1 );

  print $q->link( { template => 'bar' } );
  # outputs "template=bar;page=1"

  print $q->link( { page => 2 } );
  # outputs "template=foo;page=2"

METHODS

new ARGS

Returns a new query parameter handler. The following arguments can be passed to the constructor:

  cgi     - the CGI query.
            Will be taken from CGI.pm by default.
  discard - The parameters that will not be taken from 
            the cgi object

link ITEMS, DEFAULTS

Returns a new link out of current values and the passed items. Duplicate items are not possible.

ITEMS must be a hash reference.

Any items in the result that have the same string-value as in the DEFAULTS hashref will be omitted from the resulting string.

Currently does not URI-encode values.

hidden ITEMS, DEFAULTS

Returns a string containing the defaults and the passed items as hidden form elements. Duplicate items are not possible.

ITEMS must be a hash reference.

Currently does not HTML-encode values.

merged ARGS

Merges the hashref passed via ARGS and returns a fresh hashref to the merged hash.

All keys mentioned in discard are removed.

param

Passes through to the param method of the cgi object.

LICENSE

This module may be used under the same terms as Perl itself

AUTHOR

Max Maischein, <corion@cpan.org>

SEE ALSO

CGI.pm