&path_web: Allow overriding $WebConfig{"Wabs"} by the argument {"abs"}.
[MyWeb.git] / Web.pm
diff --git a/Web.pm b/Web.pm
index d84cadc..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());
 }
 
@@ -907,7 +909,9 @@ my($url,$contents,%args)=@_;
 
        # 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=$map{_cc()};
+       my $r;
+       $r||=$map{_cc()};
+       $r||=$map{""};
        return $r if $r;
        return $contents;
 }
@@ -918,7 +922,11 @@ sub text_cc($)
 {
 my($tree)=@_;
 
-       return $tree->{_cc()};
+       cluck if !$tree->{""};
+       my $r;
+       $r||=$tree->{_cc()};
+       $r||=$tree->{""};
+       return $r;
 }
 
 sub make ($)