Michael Schilli > Perl-Configure-0.08 > Perl::Configure::Questions

Download:
Perl-Configure-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Perl::Configure::Questions - Questions asked by perl's Configure

SYNOPSIS ^

  use Perl::Configure::Questions;

  my $q = Perl::Configure::Questions->new();

      # Add a new (customized) token/question
  $q->add($token, $question, $sample_answer, $override)

      # These are used by Perl::Configure internally
  my @questions = $q->questions();
  my @patterns  = $q->patterns();
  my @tokens    = $q->tokens();
  my $by_key    = $q->by_key();

DESCRIPTION ^

questions() returns a list of questions asked by perl's Configure. patterns() just runs a quotemeta() on the strings returned by @questions. This module is used internally by Perl::Configure.

Question Format

The questions recognized by Perl::Configure are stored in YAML format in the __DATA__ section of Perl::Configure::Questions:

    ...
    ---
    - vendor-specific-prefix
    - Installation prefix to use for vendor-supplied add-ons?
    - '/foobar'
    ---
    ...

The first line in each tuple (separated by --- according to YAML rules) holds the token, vendor-specific-prefix in the example above. The second line shows the question regular expression and the third line a 'sample answer', which is just used for documentation purposes.

Overriding Configure's defaults by default

If there is an optional forth line specifying an override answer, Perl::Configure will use this answer on a match that does not have an answer defined by the user. For example, when a part of the installation path is missing, perl's Configure will ask "Use that name anyway?" and provide "n" as a default. This, of course, is unfortunate, since accepting the default will cause Configure to pop the question again and have Perl::Configure enter an endless loop.

For this reason, "dir-check" has a fourth parameter defined that overrides Configure's default of "n" with "y":

    - dir-check
    - Use that name anyway?
    - n
    - y

Same holds true for the question of reusing an existing config.sh file, which gets overridden to "n" to start from a clean slate every time.

Fuzzy matching

Note that regex meta characters in the question line are not escaped. Instead, if a part of the question should match any text, use the ANY{...} clause:

    ...
    ---
    - compiler-flags-special
    - Any special flags to pass to ANY{cc -c} to compile shared library modules?
    - '-fpic'
    ---
    ...

This will cause the question matcher to accept any text instead of cc -c, which comes in handy if Configure dynamically replaces these parts based on previous selections.

Remove questions

To debug problems with automatically provided answers that cause endless loops during the configuration process, it sometimes helps to remove a question from the Perl::Configure pool:

  my $q = Perl::Configure::Questions->new();
  $q->remove('dynamic-extensions');

  my $conf = Perl::Configure->new( questions => $q );

In this example, Perl::Configure won't recognize the question on dynamic extentions anymore and therefore block the Configure process at this question, allowing the operator to examine the question and the proposed answer thoroughly.

AUTHOR ^

Mike Schilli, m@perlmeister.com, 2006

COPYRIGHT AND LICENSE ^

Copyright (C) 2006 by Mike Schilli

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: