Michael G Schwern <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 17, 2003 at 10:35:36AM +0000, Slaven Rezic wrote:
> > > How do you plan on assigning PERL_MM_DEFAULT_DB on a per module basis
> > > from CPAN/CPANPLUS? Or will you build One Grand Default File and One
> > > Grand Makefile.PL Parser?
> > >
> >
> > PERL_MM_DEFAULT_DB is global for all modules. The key of the dbm file
> > could be "$extension_name $prompt_text". An additional Makefile.PL
> > parser is not necessary, just the change to prompt() [and telling the
> > module authors to use prompt() everywhere interactive configuration
> > is necessary].
>
> I simply don't see this as scaling. The text of the prompts is going to
> change in small ways all the time, so you can't rely on simply string
> equality. Regexes might be able to get away with it, but than requires
> an MLDBM approach to the DBM file since we now have to do something like
> this:
>
> my $defaults = $Default_DB{$module_name};
> my $value;
> foreach my $regex (keys $defaults) {
> if( $prompt =~ /$regex/ ) {
> $value = $defaults->{$regex};
> last;
> }
> }
I thought of a solution that is non-intrusive as possible. The perfect
solution would be to change prompt() to accept ($text, $default, $identifier)
and use the $identifier as databsae key. However this requires changing
all the prompts() calls in the existing Makefile.PLs.
> And how do you edit that DBM file? Do we need to ship a tool for that
> as well or does every user write their own program for that?
Something like
perl -MTk -MTk::ObjEditor -MAnyDBM_File -e 'tie %db, "AnyDBM_File",
"/tmp/perl-defaults.db", O_RDONLY, 0666; tkinit->ObjEditor(caller => \%db)->pack;
MainLoop'
could work :-) But it's probably better to use a YAML file instead.
> And then what about Module::Build-based modules? Do they need to
> duplicate that?
Yes.
> No, this is definately a major new feature that I don't want to get into.
> Also, this strikes me as something better handled inside the CPAN shell.
How? CPAN.pm doesn't know anything about the user's interaction with
Makefile.PL. I also think that the feature is also useable for
non-CPAN.pm operation. prompt() lacks a history function and it's
often cumbersome to enter the same values again and again if
somewhere happens to be a mistake.
Regards,
Slaven
--
Slaven Rezic - slaven <at> rezic <dot> de