Matt Kettler wrote:
> At 04:35 PM 1/11/2005, [EMAIL PROTECTED] wrote:
>> Couldn't this be auto-detected for?  Something like
>> 
>> if (-d $bayes_path)
>> {       $bayes_path =~ s(/?$)(/bayes);
>> }
> 
> Yes, but what if the user really wanted the original option, and the
> directory exists as an error? 
> 
> In some ways it's nice to auto-correct user errors, but you need to be sure
> you're doing the right thing. Sometimes trying to "Do what I mean not what
> I say" can bite you.

Sure DWIM is dangerous, but you must admit the option name is misleading.

Maybe a more guarded

if (    $bayes_path !~ m(/bayes$) and   # possible error?
        (       $bayes_path =~ m(/$) or # trailing slash
                -d $bayes_path and      # directory exists
                ! -e "${bayes_path}_toks"       # database doesn't exist
        )
)
{       warn "Possible bayes_path error - did you mean $bayes_path/bayes?";
}

Matthew.van.Eerde (at) hbinc.com                 805.964.4554 x902
Hispanic Business Inc./HireDiversity.com         Software Engineer
perl -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"

Reply via email to