This file documents the revision history for Perl extension Catalyst.
+ - nuked each() out of core with prejudice (due to lurking buglets)
+ - Added tests from phaylon for dispatcher precedence
- Use Class::Inspector->loaded($class) instead of $class->can('can')
- Added ActionClass attribute
- Removed Test::WWW::Mechanize::Catalyst from Makefile.PL (circular dep)
if (@_) {
my $stash = @_ > 1 ? {@_} : $_[0];
croak('stash takes a hash or hashref') unless ref $stash;
- while ( my ( $key, $val ) = each %$stash ) {
- $c->{stash}->{$key} = $val;
+ foreach my $key ( keys %$stash ) {
+ $c->{stash}->{$key} = $stash->{$key};
}
}
return $c->{stash};
my ( $self, $c ) = @_;
my @cookies;
- while ( my ( $name, $cookie ) = each %{ $c->response->cookies } ) {
+
+ foreach my $name ( keys %{ $c->response->cookies } ) {
+
+ my $val = $c->response->cookies->{$name};
my $cookie = CGI::Cookie->new(
-name => $name,
- -value => $cookie->{value},
- -expires => $cookie->{expires},
- -domain => $cookie->{domain},
- -path => $cookie->{path},
- -secure => $cookie->{secure} || 0
+ -value => $val->{value},
+ -expires => $val->{expires},
+ -domain => $val->{domain},
+ -path => $val->{path},
+ -secure => $val->{secure} || 0
);
push @cookies, $cookie->as_string;
my ( $self, $c ) = @_;
# We copy, no references
- while ( my ( $name, $param ) = each %{ $c->request->query_parameters } ) {
+ foreach my $name ( keys %{ $c->request->query_parameters } ) {
+ my $param = $c->request->query_parameters->{$name};
$param = ref $param eq 'ARRAY' ? [ @{$param} ] : $param;
$c->request->parameters->{$name} = $param;
}
# Merge query and body parameters
- while ( my ( $name, $param ) = each %{ $c->request->body_parameters } ) {
+ foreach my $name ( keys %{ $c->request->body_parameters } ) {
+ my $param = $c->request->body_parameters->{$name};
$param = ref $param eq 'ARRAY' ? [ @{$param} ] : $param;
if ( my $old_param = $c->request->parameters->{$name} ) {
if ( ref $old_param eq 'ARRAY' ) {
local (*ENV) = $self->env || \%ENV;
# Read headers from %ENV
- while ( my ( $header, $value ) = each %ENV ) {
+ foreach my $header ( keys %ENV ) {
next unless $header =~ /^(?:HTTP|CONTENT|COOKIE)/i;
( my $field = $header ) =~ s/^HTTPS?_//;
- $c->req->headers->header( $field => $value );
+ $c->req->headers->header( $field => $ENV{$header} );
}
}
my $sockdata = $self->_socket_data( \*Remote );
my $ipaddr = _inet_addr( $sockdata->{peeraddr} );
my $ready = 0;
- while ( my ( $ip, $mask ) = each %$allowed and not $ready ) {
+ foreach my $ip ( keys %$allowed ) {
+ my $mask = $allowed->{$ip};
$ready = ( $ipaddr & _inet_addr($mask) ) == _inet_addr($ip);
+ last if $ready;
}
if ($ready) {
$restart = 1;