From: Jamie C. <jca...@we...> - 2003-01-07 21:13:29
|
You don't have to declare variables - any that are used without being declared are considered by Perl to be global (to the main package, which is used by default when no package is explicitly specified). - Jamie Wai Iu wrote: > Jamie: > > Thanks for your reply. I have another question regarding > main::read_file_cache. > > In order to use a reference, you must to declared it > at first, for example, my $ref; $ref=7; . But in the method > read_file_cached, main::read_file_cache seems to be just being > used and never being declared at first. And read_file_cache's > package is main. Where is this main package located? > > Same thing happening to the other references: main:acl_hash_cache, > main::acl_array_cache, main::has_command_cache, main::list_languages_ > cache. > > Thanks again! > > > Wai > > -----Original Message----- > From: Jamie Cameron [mailto:jca...@we...] > Sent: Mon 1/6/2003 5:36 PM > To: web...@li... > Cc: > Subject: Re: where main::read_file_cache being initialized? > > > > Wai Iu wrote:> Hey; > > > > In the file web-lib.pl, there are following paramaters used, > > such as in flush_webmin_caches() method and in init_config() > > method: > > > > %main::read_file_cache > > %main::acl_hash_cache > > %main::acl_array_cache > > %main::has_command_cache > > @main::list_languages_cache > > > > > > I checked the web-lib.pl and did not find any place that they are> being initialized. Where do these parameters come from? > > Various places : > > read_file_cache - Set by the read_file_cached function, so that > multiple calls for the same file do not have to actually read it. > > acl_hash_cache and acl_array_cache - Set by read_acl so that > /etc/webmin/webmin.acl only has to be read once. > > has_command_cache - Set by has_command, so that multiple calls for the > same command do not have to check the PATH each time. > > list_languages_cache - Set by list_languages so that lang_list.txt > only has to be read once. > > - Jamie |