sub new { my $type = shift; my $resfile = shift; my ($name, $valdoc, $app); my $res = bless {}; $res->{Load} = 0; # 1 if loading $res->{Merge} = 0; # 1 if merging $res->{Wilds} = {}; # Wildcarded resources. $res->{Res} = {}; # Named resources. $res->{Owned} = {}; # Inverted index of member clases. $res->{Isa} = {}; # Inverted index of base classes. # Safe environment for the evaluation of constructors. $res->{Safe} = new Safe or ($res->_error("new", "can't get a Safe object."), return undef); # Hack hack - the special filename "_RES_NODEFAULTS" is # used to prevent resource initialization (e.g. when called by the # "bypattern" method unless ($resfile and $resfile eq "_RES_NODEFAULTS") { # Must make sure this is not overridden by a wildcard $res->{Wilds}->{'.*resources\.updates'} = [0]; $res->{Res}->{'resources.updates'}->[$Value] = 0; # Get appclass without extensions if (($app = $Resources{'resources.appclass'}->[$Value]) =~ /\./) { $Resources{'resources.appclass'}->[$Value] = (split(/\./, $app))[0]; } # Bootstrap defaults. We don't want any subclassing here while (($name, $valdoc) = CORE::each(%Resources)) { $res->{Res}->{$name} = $valdoc; } } if ($resfile and $resfile ne "_RES_NODEFAULTS") { $res->load($resfile) || ($res->_error("new", "can't load"), return undef); } $res; }