in reply to setting session variables
not the same aselsif( (!$post{'page'}) && (!$self->session->param('page')) ) { $self->session->param('page' => 1); } else { $self->session->param('page' => 1); }
?else{ $self->session->param('page' => 1); }
And
also looks redundant.if($post{'page'}){ ... } elsif( (!$post{'page'}) && ...) {
How about this:
This also scales nicely with an increasing number of session variables (if all of them default to 1 ).my $session = $self->session; foreach (qw[ page ] ) { $session->param( $_ => $post{$_} ? $post{$_} : 1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: setting session variables
by boboson (Monk) on May 18, 2005 at 09:36 UTC |