fix undefined warning in apache cgi path
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 31 May 2008 19:57:57 +0000 (19:57 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 31 May 2008 20:00:12 +0000 (20:00 +0000)
PATH_INFO was intentionally declared undef in PLP::Backend::CGI, but
would be concatenated later (in Apache mode at least), giving warnings
since d9f3acb221a71e094318c7b5d3809aa81db (use warnings in all modules).

lib/PLP/Backend/CGI.pm

index 10b9b45618b2d1bc2dc48f90ca17266d45acbf0d..e952c5a0796dcf27c302fefd5be00d0e7d62be25 100644 (file)
@@ -17,7 +17,7 @@ sub init {
                # Run backwards through PATH_TRANSLATED to find target filename,
                # then get file (relative) by stripping PATH_INFO.
                my ($path, $rel) = (delete $ENV{PATH_TRANSLATED}, delete $ENV{PATH_INFO});
-               my $path_info;
+               my $path_info = '';
                while (not -f $path) {
                        if (not $path =~ s/(\/+[^\/]*)$//) {
                                printf STDERR "PLP: Not found: $path$path_info ($ENV{REQUEST_URI})\n";
@@ -27,7 +27,7 @@ sub init {
                        # move last path element onto PATH_INFO
                        $path_info = $1 . $path_info;
                }
-               if (defined $path_info) {
+               if ($path_info ne '') {
                        $rel =~ s/\Q$path_info\E$//;
                        $ENV{PATH_INFO} = $path_info;
                }