>
> >
> >foreach my $attr ( keys %_default ) {
> > my ($argname) = ($attr =~ tr/a-z/A-Z/); # make sure key is
> >uppercase(like FILE)
>
> But you get to populate %_default, right? So you can make
> sure that the
> keys are uppercase. I don't understand why you do this tr.
The user will not populate the %_default. That hash is there to provide
default values and make sure the args passed our allowable. The args being
passed to the constructor will go into %args. So if the user creates and
object like this:
my $log = new Logs (FILE => 'mylogfile',
FORM => 'htm'
);
%args will not contain: FILE => 'mylogfile',FORM => 'htm'
so the reason I do the tr/// is to make sure the arg key FILE and FORM are
uppercase.
>
> > if (exists $args{$argname}) # match
> against %args
> >
> > { $self->{$attr} = $args{$argname} } # if
> the arg key exists
> >use that
> > else
> > { $self->{$attr} = $self->_default($attr) } #
> if not use defualt
> >}
>
> I assume that _default is a method that accesses %_default,
woops, that was a typo, is should be:
{ $self->{$attr} = $self->$_default($attr) }
>
> >--
> >now how can I validate the $_default->{FORM} values are one of
>
> I thought you were validating %args, not %_default.
yes, right, another damn typo sorry. I am tryint to validate %args against
%_default
>
> >['unix_txt', 'htm', 'win_txt'] ??
>
> Suggest instead defining it as
>
> FORM => { unix_txt => 1, htm => 1, win_txt => 1 }
so make a hash of hashes ?
>
> and then you can test
>
> if ($_default{FORM}{$args{$argname}}
hmm, that might work. I will give it a try.
Thanks for the help
Jim
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]