diff options
author | Yorhel <git@yorhel.nl> | 2008-10-22 16:27:33 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-10-22 16:27:33 +0200 |
commit | 04519dab6e214a0f87e5384236cc0a888b9768cc (patch) | |
tree | 346ff33c4e632edb40e432c5e64c34837f8fd135 /lib | |
parent | c01488dbcf6f8e454c5b8a12c729b9786e5d9333 (diff) |
Renamed reqURI to reqPath and reqFullURI to reqURI
Use the correct terminology, the older naming would undoubtedly cause
confusion at some point
Diffstat (limited to 'lib')
-rw-r--r-- | lib/YAWF.pm | 4 | ||||
-rw-r--r-- | lib/YAWF/Request.pm | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/YAWF.pm b/lib/YAWF.pm index 5c5116a..7d0fcc5 100644 --- a/lib/YAWF.pm +++ b/lib/YAWF.pm @@ -78,7 +78,7 @@ sub log_warning { seek $F, 0, 2; while(local $_ = shift) { chomp; - printf $F "[%s] %s: %s\n", scalar localtime(), $OBJ->reqFullURI||'[init]', $_; + printf $F "[%s] %s: %s\n", scalar localtime(), $OBJ->reqURI||'[init]', $_; } flock $F, 4; close $F; @@ -136,7 +136,7 @@ sub handle_request { $self->{_YAWF}{pre_request_handler}->($self) if $self->{_YAWF}{pre_request_handler}; # find the handler - my $loc = $self->reqURI; + my $loc = $self->reqPath; study $loc; my $han = $self->{_YAWF}{error_404_handler}; for (@handlers ? 0..$#handlers/2 : ()) { diff --git a/lib/YAWF/Request.pm b/lib/YAWF/Request.pm index 57bcccd..7573bde 100644 --- a/lib/YAWF/Request.pm +++ b/lib/YAWF/Request.pm @@ -10,7 +10,7 @@ use CGI::Minimal; our @EXPORT = qw| reqInit reqParam reqSaveUpload reqCookie - reqMethod reqHeader reqURI reqFullURI reqHost reqIP + reqMethod reqHeader reqPath reqURI reqHost reqIP |; @@ -71,14 +71,15 @@ sub reqHeader { } -sub reqURI { +# returns the path part of the current URI, excluding the leading slash +sub reqPath { (my $u = $ENV{REQUEST_URI}) =~ s{^/+}{}; return $u; } # returns undef if the request isn't initialized yet -sub reqFullURI { +sub reqURI { return $ENV{HTTP_HOST} && defined $ENV{REQUEST_URI} ? $ENV{HTTP_HOST}.$ENV{REQUEST_URI}.($ENV{QUERY_STRING} ? '?'.$ENV{QUERY_STRING} : '') : undef; |