CGI-Application-Framework
view release on metacpan or search on metacpan
default => $default_examples_url,
pre_defined => $builder->args('examples-url'), # skip question if already defined
);
my $default_cgi_bin_path = File::Spec->catdir($root, 'cgi-bin' );
$cgi_bin_path = $builder->multiple_choice(
question_name => 'cgi-bin-path',
preamble => qq{
cgi-bin path
------------
This is the location where the app.cgi script will be
installed. The location you choose should be configured in
your web server as a location in which CGI scripts can be run.
We need both the filesystem path and the URL by which this location
can be publicly accessed.
If you specify a location that is already within your web
server's existing cgi-bin directory, then you should not
have to any additional webserver configuration.
On the other hand, if you choose a location that is outside
of your public cgi-bin directory, you will need to configure
your web server to make this location public and capable of
running CGI scripts. For instance, if you are using Apache,
you will need to add the following lines to httpd.conf:
ScriptAlias /caf-cgi $default_cgi_bin_path
Where do you want the cgi-bin files to be installed (path)?
},
choices => $default_cgi_bin_path,
default => $default_cgi_bin_path,
pre_defined => $builder->args('cgi-bin-path'), # skip question if already defined
);
# Make a guess at the cgi-bin url by taking the last element
# of $cgi_bin_path
($volume, @path) = File::Spec->splitpath($cgi_bin_path);
my $default_cgi_bin_url = '/' . pop @path;
$cgi_bin_url = $builder->multiple_choice(
question_name => 'cgi-bin-url',
preamble => qq{
What is the URL to the cgi-bin directory?
},
choices => $default_cgi_bin_url,
default => $default_cgi_bin_url,
pre_defined => $builder->args('cgi-bin-url'), # skip question if already defined
);
$user = 'nobody';
$group = 'nobody';
$webuser = 'nobody';
$webgroup = 'nobody';
if ($^O !~ /Win32/) {
my $default_user = getpwuid($<);
my $default_group = getgrgid($();
my @users = ($default_user, qw(www-data web www nobody));
my @groups = ($default_group, qw(www-data web www nobody));
$user = $builder->multiple_choice(
question_name => 'user',
preamble => qq{
Examples User
-------------
What user do you want the installed example files
to be owned by?
},
prompt => 'Examples user (pick a number or enter a username)',
choices => \@users,
default => $users[0],
pre_defined => $builder->args('user'), # skip question if already defined
);
# Add the selected user to the list of groups
# if it also happens to be a valid group name
if (! grep { /$user/ } @users) {
if (getgrnam($user)) {
push @groups, $user;
}
}
$group = $builder->multiple_choice(
question_name => 'group',
preamble => qq{
Examples Group
--------------
},
choices => \@groups,
default => $groups[0],
prompt => 'Examples group (pick a number or enter a group name)',
pre_defined => $builder->args('group'), # skip question if already defined
);
my @web_users = qw(www-data web www nobody);
my @web_groups = qw(www-data web www nobody);
$webuser = $builder->multiple_choice(
question_name => 'webuser',
preamble => qq{
Web Server User
---------------
This is the system user that Apache runs under.
Certain files have to be writeable by this user.
},
prompt => 'Web server user (pick a number or enter a username)',
choices => \@web_users,
default => $web_users[0],
pre_defined => $builder->args('webuser'), # skip question if already defined
);
if (! grep { /$webuser/ } @web_users) {
( run in 3.665 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )