CGI-Application-Framework
view release on metacpan or search on metacpan
preamble => qq{
Root Installation Directory
---------------------------
This should probably be in the directory of a virtual host that you've set up on
your local web server. It could also be in your home directory.
Where do you want the root of the installation to be?
},
choices => \@root_dirs,
default => $root_dirs[0],
pre_defined => $builder->args('root'), # skip question if already defined
);
$framework_root = $builder->multiple_choice(
question_name => 'framwork-root',
preamble => qq{
Framework Root
--------------
This should be within the virtual host ($root),
but NOT within the publicly visible web root. In this directory
will go all of your web application's projects, sessions logs, etc.
Where do you want the framework root to be?
},
choices => File::Spec->catdir($root, 'framework'),
default => File::Spec->catdir($root, 'framework'),
pre_defined => $builder->args('framework-root'), # skip question if already defined
);
my $default_examples_path = File::Spec->catdir($root, 'htdocs', 'caf-examples');
$examples_path = $builder->multiple_choice(
question_name => 'examples-path',
preamble => qq{
Web Examples (HTML + CSS)
-------------------------
This is the location (in your public webroot) where the
example files (html, images, css files, etc.) will be
installed. We need both the filesystem path and the
URL by which they can be publicly accessed.
If you specify a location that is already within your
web server's public web space, 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 web space you will need to configure
your web server to make this location public. For instance,
if you are using Apache, you will need to add the following lines
to httpd.conf:
Alias /caf $default_examples_path/htdocs/caf-examples/
Where do you want the example files to be installed (path)?
},
choices => $default_examples_path,
default => $default_examples_path,
pre_defined => $builder->args('examples-path'), # skip question if already defined
);
# Make a guess at the examples url by taking the last element
# of $examples_path
my ($volume, @path) = File::Spec->splitpath($examples_path);
my $default_examples_url = '/' . pop @path;
$examples_url = $builder->multiple_choice(
question_name => 'examples-url',
preamble => qq{
What is the URL to the example files?
},
choices => $default_examples_url,
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
( run in 0.571 second using v1.01-cache-2.11-cpan-39bf76dae61 )