Fixed warn for 'Wuse' before setting $W->{"__PACKAGE__"}.
[MyWeb.git] / Web.pm
diff --git a/Web.pm b/Web.pm
index cf02915..3e7f05e 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -46,9 +46,11 @@ BEGIN
                $file.=".pm";
                my $who=$W->{"__PACKAGE__"};
                $who||="__My::Web" if $W->{"__My::Web_init"};
-               my $aref=($W->{"packages_used"}{$who}||=[]);
-               push @$aref,$class
-                               if !{ map(($_=>1),@$aref) }->{$class};  # Prevent duplicated entries.
+               if ($who) {
+                       my $aref=($W->{"packages_used"}{$who}||=[]);
+                       push @$aref,$class
+                                       if !{ map(($_=>1),@$aref) }->{$class};  # Prevent duplicated entries.
+                       }
                CORE::require $file;
                1;      # Otherwise 'require' would already file above.
        }
@@ -289,6 +291,7 @@ sub fatal (;$)
 my($msg)=@_;
 
        $msg="UNKNOWN" if !$msg;
+       cluck "FATAL: $msg";
 
        $W->{"indexme"}=0;      # For the case no heading was sent yet.
        $W->{"heading_done"}=0; # for the case of already sent {"header_only"}==1