Nathan Wiger <[EMAIL PROTECTED]> wrote:
>Hi all-
>
>I've written a module that can parse the Apache httpd.conf config file
>(and in fact any Apache-like config file). It will take a set of
>directive like:
>
>     ServerName         www.mydomain.com
>     UseCanonicalName   Off
> 
>And parse it case-insensitively, returning a ref to a hash:
>
>    my $ac = new Apache::Config;
>    my $conf = $ac->readconf($configfile);
>    print $conf->{servername};       # = "www.mydomain.com";
>    print $conf->{usecanonicalname}; # = 0   (not undef so can test
>                                     #        for defined() still)
>

Sorry for two posts...  thought about this right after sending the first...

You might want to reconsider the usecanonicalname setting.  The hash element 
should exist if and only if it appears in the configuration file.  It should 
be defined if and only if it has an argument in the configuration file.

Thus, the following results:

    UseCanonicalName
results in $conf->{usecanonicalname} == undef

    UseCanonicalName  Off
results in $conf->{usecanonicalname} == 0

Then use existance in the hash array to test existance in the configuration 
file.  You may have already been thinking along this line.  If so, then I'm 
only clarifying a point...
-- 
James Smith <[EMAIL PROTECTED]>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix


Reply via email to