&path_web: Allow overriding $WebConfig{"Wabs"} by the argument {"abs"}.
[MyWeb.git] / Web.pm
diff --git a/Web.pm b/Web.pm
index d31ef5e..143f3a7 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -570,7 +570,7 @@ my($in)=@_;
 }
 
 # $args{"uri_as_in"}=1 to permit passing URI objects as: $in
-# $args{"abs"}=1;
+# $args{"abs"}=0 || 1; # overrides: $W->{"args"}{"Wabs"}
 sub path_web($%)
 {
 my($in,%args)=@_;
@@ -589,7 +589,9 @@ my($in,%args)=@_;
                                %{$uri->query_form_hash()},
                                });
                }
-       return $uri->abs(unparsed_uri()) if $W->{"args"}{"Wabs"} || $args{"abs"};
+       my $abs;
+       do { $abs=$_ if defined; } for $W->{"args"}{"Wabs"},$args{"abs"};
+       return $uri->abs(unparsed_uri()) if $abs;
        return $uri->rel(unparsed_uri());
 }
 
@@ -905,13 +907,13 @@ sub a_href_cc($$;%)
 {
 my($url,$contents,%args)=@_;
 
-       cluck if !$url->{""};
        # A bit ineffective but we must process all the possibilities to get stable 'headers_in' hits!
        my %map=map(($_=>a_href($url->{$_},$contents,%args)),keys(%$url));
        my $r;
        $r||=$map{_cc()};
        $r||=$map{""};
-       return $r;
+       return $r if $r;
+       return $contents;
 }
 
 # $tree={"JP"=>"specific",...};