16 $uri->scheme($scheme);
18 if (defined $username) {
19 $uri->authority( "$username:$password" );
23 $uri->port($port) if $port;
25 elsif (defined $relative && $relative)
27 # this is a local link and conversion from absolute to relative
30 # original component path (e. g. 'htdocs/news/index.html')
31 my @caller_path = File::Spec->splitdir($m->request_comp()->path());
33 # remove target directory portion
34 # e. g. ('news', 'index.html')
38 # remove filename portion
42 my $caller_dir = File::Spec->catfile("", @caller_path);
43 $caller_dir = "/" if ($caller_dir eq "");
45 $path = File::Spec->abs2rel($path, $caller_dir);
47 $path = "." if ($path eq "");
50 # Sometimes we may want to path in a query string
51 # but the URI module will escape the question mark.
54 if ( $path =~ s/\?(.*)$// ) {
60 # If there was a query string, we integrate it into the query
63 %query = ( %query, split /[&=]/, $q );
66 # $uri->query_form doesn't handle hash ref values properly
67 while ( my ( $key, $value ) = each %query ) {
68 $query{$key} = ref $value eq 'HASH' ? [ %$value ] : $value;
71 $uri->query_form(%query) if %query;
73 $uri->fragment($fragment) if $fragment;
75 <% $uri->canonical | n %>\