Great Circle Associates Majordomo-Users
(January 1999)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: PERL question: config_parse.pl
From: Bob Dusek <bobd @ palaver . net>
Date: Wed, 20 Jan 1999 21:34:32 -0500 (EST)
To: majordomo-users @ greatcircle . com

Hey folks,

I've been sifting through the config_parse.pl and majordomo code,
trying to figure out just how this thing works, and I am getting stumped
by a particular function call:

In majordomo, the script that resides in the majordom homedir, several
of the do* functions have this line of code in them:

&get_config($listdir, $clean_list, "locked")
            if !&cf_ck_bool($clean_list, '', 1);

What confuses me is the function call to &cf_ck_bool();

The function call has three arguments, the second of which is null
or nothing, the third of which doesn't mean anything.... or so it seems.

Here's the function definition of cf_ck_bool():

------

# get the boolean value. Return true if not the number 0 or null.
sub main'cf_ck_bool { #given the name of the list and item, look it up
  local($list, $key) = @_;

  return (1) if (($main'config_opts{$list,$key} != 0) &&
                    $main'config_opts{$list,$key} ne '');
  return (0);
}

------

In &cf_ck_bool(), $list takes on the value of $clean_list from the above
function call.  But, $key doesn't appear to be taking on any value at all.
Furthermore, why give the function call a third parameter, 1?

It seems that every function call like this would return 0, since I 
can't find the a statement that initializes config_opts{"somelistname,"}.

Why not, instead of using this function call, just hardwire a '0'
into the code where needed??

I'm sure there is a good answer to this, but I need some clues to find it.

Thanks,

Bob



Follow-Ups:
Indexed By Date Previous: Message with no subject and subject prefixes
From: Jeffrey Goldberg <J.Goldberg@Cranfield.ac.uk>
Next: Re: automatic config file setup??
From: Carlos Araya <elrond@valinor.sjsu.edu>
Indexed By Thread Previous: Re: Message with no subject and subject prefixes
From: Jeffrey Goldberg <J.Goldberg@Cranfield.ac.uk>
Next: Re: PERL question: config_parse.pl
From: Jason L Tibbitts III <tibbs@math.uh.edu>

Google
 
Search Internet Search www.greatcircle.com