You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Al...@nokia.com on 2004/04/30 18:17:33 UTC

Printing the called address without PATH_INFO and QUERY_STRING

Hi,

this is probably somewhere in the docs, but I can't find it...
Would some kind sould please advise me, how to print the 
hostname and the called script in the error message below?

    # Extract port, user, default database from PATH_INFO
    $port  = $1 if $r->path_info() =~ /\/port=(\d+)/i;
    $owner = $1 if $r->path_info() =~ /\/owner=(\w+)/i;
    $dbase = $1 if $r->path_info() =~ /\/dbase=(bo_\w+)/i;
    $task  = $1 if $r->path_info() =~ /\/task=task(\d+)/i;
    unless ($port and $owner and $dbase and $task) {
        printf "<H2>Error: This script should be called as http://%s/taskit/port=1234/owner=afarber/dbase=bo_test/task=task123</H2>", $r->server->server_hostname();
        $r->log_error('PATH_INFO unset or wrong: ' . $r->path_info());
        goto END;
    }

Thanks
Alex

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Printing the called address without PATH_INFO and QUERY_STRING

Posted by Perrin Harkins <pe...@elem.com>.
On Fri, 2004-04-30 at 12:17, Alexander.Farber@nokia.com wrote:
> Hi,
> 
> this is probably somewhere in the docs, but I can't find it...
> Would some kind sould please advise me, how to print the 
> hostname and the called script in the error message below?

Sounds like you're looking for this:
http://perl.apache.org/docs/1.0/api/Apache/URI.html

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html