Skip Menu |

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 8090
Status: resolved
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: tim [...] fefcful.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Change to clear method allows clearing based on regular expression
I made a change to my local copy of CGI::Session to allow clearing of parameters that match a regular expression by passing a regular expression reference to $session->clear(). I think this is a useful feature because it allows easier isolation of parameters that relate to a specific task. For example, all of the applications on my staff intranet are entered through a login application. The login app authenticates users and then loads a series of permissions into a session which is shared by all of the applications. One of my applications allows the creation and modification of "events". It uses CGI::Session to store information about the event that is currently being edited. Using the new version of the clear method I can organize parameters with prefixes like _login_, _eventregistration_, _timecard_, etc. Then, within an application I can call $session->clear(qr/_eventregistration_/) to clear just the event registration parameters. I've pasted the new version of the clear sub below. --TWH # clear() - clears a list of parameters off the session's '_DATA' table sub clear { my $self = shift; $class = ref($self); my @params = (); # if there was at least one argument, we take it as a list # of params to delete if ( @_ ) { #@params = ref($_[0]) ? @{ $_[0] } : ($_[0]); #Old version without support for regexref if (ref($_[0]) eq 'ARRAY'){ @params = @{ $_[0] }; }elsif (ref($_[0]) eq 'Regexp'){ #Perform regular-expression matching foreach ($self->param()){ push(@params, $_) if /$_[0]/; #Include parameters that match the regular expression referenced by $_[0] } }else{ @params = ($_[0]); } } else { @params = $self->param(); } my $n = 0; for ( @params ) { /^_SESSION_/ and next; # If this particular parameter has an expiration ticker, # remove it. if ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ) { delete ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ); } delete ($self->{_DATA}->{$_}) && ++$n; } # Set the session '_STATUS' flag to MODIFIED $self->{_STATUS} = MODIFIED; return $n; }
From: markstos [...] cpan.org
[guest - Thu Oct 21 16:55:45 2004]: Show quoted text
> I made a change to my local copy of CGI::Session to allow clearing of > parameters that match a regular expression by passing a regular > expression reference to $session->clear(). I think this is a > useful feature because it allows easier isolation of parameters > that relate to a specific task. For example, all of the > applications on my staff intranet are entered through a login > application. The login app authenticates users and then loads a > series of permissions into a session which is shared by all of the > applications. One of my applications allows the creation and > modification of "events". It uses CGI::Session to store > information about the event that is currently being edited. Using > the new version of the clear method I can organize parameters with > prefixes like _login_, _eventregistration_, _timecard_, etc.
Then, Show quoted text
> within an application I can call > $session->clear(qr/_eventregistration_/) to clear just the event > registration parameters. > > I've pasted the new version of the clear sub below. > > --TWH > > # clear() - clears a list of parameters off the session's '_DATA' > table sub clear { my $self = shift; $class = ref($self); > > my @params = (); > > # if there was at least one argument, we take it as a list # of
params Show quoted text
> to delete if ( @_ ) { #@params = ref($_[0]) ? @{ $_[0] } :
($_[0]); Show quoted text
> #Old version without support for regexref if (ref($_[0]) eq > 'ARRAY'){ @params = @{ $_[0] }; }elsif (ref($_[0]) eq 'Regexp'){ > #Perform regular-expression matching foreach ($self->param()){ > push(@params, $_) if /$_[0]/; #Include parameters that match the > regular expression referenced by $_[0] } }else{ @params = ($_[0]); > } } else { @params = $self->param(); } > > my $n = 0; > for ( @params ) { > /^_SESSION_/ and next; > # If this particular parameter has an expiration ticker, # remove it. > if ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ) { delete ( $self-
> >{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ); } delete
($self->{_DATA}- Show quoted text
> >{$_}) && ++$n; }
> > # Set the session '_STATUS' flag to MODIFIED $self->{_STATUS} = > MODIFIED; > > return $n; > }
Tim, This seems like a reasonable "wish list" request. Could you submit a new patch against the latest 4.x developer release that also includes update POD and automated tests? Please CC: directly at markstos@cpan.org if you do. Thanks, Mark
Tim, This is a reminder that we are waiting on updating docs and automated tests to include this in the CGI::Session distribution. The ticket has been open for almost a year, and no one else as commented with interest on it, so it's back in your court. If I don't hear back from you with in an initial response in a week or so, I'll assume the ticket can be resolved for now. Mark On Mon Jul 04 16:39:34 2005, MARKSTOS wrote: Show quoted text
> [guest - Thu Oct 21 16:55:45 2004]: >
> > I made a change to my local copy of CGI::Session to allow clearing
of Show quoted text
> > parameters that match a regular expression by passing a regular > > expression reference to $session->clear(). I think this is a > > useful feature because it allows easier isolation of parameters > > that relate to a specific task. For example, all of the > > applications on my staff intranet are entered through a login > > application. The login app authenticates users and then loads
a Show quoted text
> > series of permissions into a session which is shared by all of
the Show quoted text
> > applications. One of my applications allows the creation and > > modification of "events". It uses CGI::Session to store > > information about the event that is currently being edited.
Using Show quoted text
> > the new version of the clear method I can organize parameters
with Show quoted text
> > prefixes like _login_, _eventregistration_, _timecard_, etc.
> Then,
> > within an application I can call > > $session->clear(qr/_eventregistration_/) to clear just the event > > registration parameters. > > > > I've pasted the new version of the clear sub below. > > > > --TWH > > > > # clear() - clears a list of parameters off the session's '_DATA' > > table sub clear { my $self = shift; $class = ref($self); > > > > my @params = (); > > > > # if there was at least one argument, we take it as a list # of
> params
> > to delete if ( @_ ) { #@params = ref($_[0]) ? @{ $_[0] } :
> ($_[0]);
> > #Old version without support for regexref if (ref($_[0]) eq > > 'ARRAY'){ @params = @{ $_[0] }; }elsif (ref($_[0]) eq 'Regexp')
{ Show quoted text
> > #Perform regular-expression matching foreach ($self->param()){ > > push(@params, $_) if /$_[0]/; #Include parameters that match
the Show quoted text
> > regular expression referenced by $_[0] } }else{ @params =
($_[0]); Show quoted text
> > } } else { @params = $self->param(); } > > > > my $n = 0; > > for ( @params ) { > > /^_SESSION_/ and next; > > # If this particular parameter has an expiration ticker, # remove
it. Show quoted text
> > if ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ) { delete
( $self- Show quoted text
> > >{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ); } delete
> ($self->{_DATA}-
> > >{$_}) && ++$n; }
> > > > # Set the session '_STATUS' flag to MODIFIED $self->{_STATUS} = > > MODIFIED; > > > > return $n; > > }
> > Tim, > > This seems like a reasonable "wish list" request. Could you submit a > new patch against the latest 4.x developer release that also
includes Show quoted text
> update POD and automated tests? Please CC: directly at > markstos@cpan.org if you do. > > Thanks, > > Mark >