<[EMAIL PROTECTED]> writes:

> Choose site specific unattend.txt
> -----------------------------------

Nice code; thanks for sharing it.

> set_value ('Identification', 'JoinDomain',
>            sub {
>               my $name = simple_q
>                    ('Join workstation to what domain (none = enter workgroup)? ');
>               if (defined $name) {
>                  } else {
>                   set_value ('Identification', 'JoinWorkgroup', 
>                                  simple_q ('Join workstation to which workgroup? '));
>                              
>                  }
>                return $name;
>            });

Hm, calling set_value inside another set_value subroutine is actually
a lurking bug, because it is modifying a hash as it is being
enumerated.  It can fail depending on the order in which values happen
to get slurped out of the hash.

I think I will add detection code for this and bomb out when it
happens.

The set_value calls are supposed to be "declarative", so you should
try to make the subroutines free of side-effects.  I would write it
something like this:

  set_value ('Identification', 'JoinWorkgroup',
             sub {
                my $dom = get_value ('Identification', 'JoinDomain');
                if (defined $dom) {
                    return undef;
                }
                else {
                    return simple_q ('Join workstation to which workgroup? ');
                }
             });

This way, even if the JoinWorkgroup value gets requested first, it
will automatically compute the JoinDomain value (via the get_value
call).

Use another set_value if you want to override the text of the
JoinDomain question.  The order of the set_value calls themselves does
not matter, which is one of the things I like about this design.

With your permission, I would like to use these examples when (yes,
WHEN) I get around to finishing the "advanced configuration" page.

 - Pat


-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
unattended-info mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to