[Catalyst-commits] r6323 - trunk/Catalyst-Runtime/lib/Catalyst
nothingmuch at dev.catalyst.perl.org
nothingmuch at dev.catalyst.perl.org
Thu Apr 26 23:16:34 GMT 2007
Author: nothingmuch
Date: 2007-04-26 23:16:22 +0100 (Thu, 26 Apr 2007)
New Revision: 6323
Modified:
trunk/Catalyst-Runtime/lib/Catalyst/Request.pm
Log:
prevent $request->path used as setter from keeping stale data
Modified: trunk/Catalyst-Runtime/lib/Catalyst/Request.pm
===================================================================
--- trunk/Catalyst-Runtime/lib/Catalyst/Request.pm 2007-04-26 20:32:52 UTC (rev 6322)
+++ trunk/Catalyst-Runtime/lib/Catalyst/Request.pm 2007-04-26 22:16:22 UTC (rev 6323)
@@ -365,22 +365,24 @@
=cut
sub path {
- my ( $self, $params ) = @_;
+ my ( $self, @params ) = @_;
- if ($params) {
- $self->uri->path($params);
+ if (@params) {
+ $self->uri->path(@params);
+ undef $self->{path};
}
+ elsif ( defined( my $path = $self->{path} ) ) {
+ return $path;
+ }
else {
- return $self->{path} if $self->{path};
+ my $path = $self->uri->path;
+ my $location = $self->base->path;
+ $path =~ s/^(\Q$location\E)?//;
+ $path =~ s/^\///;
+ $self->{path} = $path;
+
+ return $path;
}
-
- my $path = $self->uri->path;
- my $location = $self->base->path;
- $path =~ s/^(\Q$location\E)?//;
- $path =~ s/^\///;
- $self->{path} = $path;
-
- return $path;
}
=head2 $req->protocol
More information about the Catalyst-commits
mailing list