&a_href_cc,&text_cc: Fixed defaulting to: {""}
authorshort <>
Thu, 15 Dec 2005 09:56:33 +0000 (09:56 +0000)
committershort <>
Thu, 15 Dec 2005 09:56:33 +0000 (09:56 +0000)
&a_href_cc,&text_cc: Require default {""} (or cluck).

Web.pm

diff --git a/Web.pm b/Web.pm
index d84cadc..d31ef5e 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -905,11 +905,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=$map{_cc()};
-       return $r if $r;
-       return $contents;
+       my $r;
+       $r||=$map{_cc()};
+       $r||=$map{""};
+       return $r;
 }
 
 # $tree={"JP"=>"specific",...};
@@ -918,7 +920,11 @@ sub text_cc($)
 {
 my($tree)=@_;
 
-       return $tree->{_cc()};
+       cluck if !$tree->{""};
+       my $r;
+       $r||=$tree->{_cc()};
+       $r||=$tree->{""};
+       return $r;
 }
 
 sub make ($)