summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-02-03 12:30:29 +0000
committerfukachan <fukachan>2002-02-03 12:30:29 +0000
commit0c139b006cfff447ecc455d0117faed546d5f5a8 (patch)
treea7ef9a43f043d439733b5bb02705fc56414ff10a /fml
parent338a420fd491504401968c0c8d06834215bdea0a (diff)
downloadfml8-0c139b006cfff447ecc455d0117faed546d5f5a8.tar.gz
fml8-0c139b006cfff447ecc455d0117faed546d5f5a8.tar.bz2
fml8-0c139b006cfff447ecc455d0117faed546d5f5a8.zip
we should not use $curproc->{ main_cf } directrly in modules out of FML::Process::
we implement the following methods in FML::Process::Utils and use them. o $curproc->executable_prefix() o $curproc->template_files_dir_for_newml()
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/Command/Admin/newml.pm10
-rw-r--r--fml/lib/FML/Process/Utils.pm49
2 files changed, 50 insertions, 9 deletions
diff --git a/fml/lib/FML/Command/Admin/newml.pm b/fml/lib/FML/Command/Admin/newml.pm
index 71807b44..b8856634 100644
--- a/fml/lib/FML/Command/Admin/newml.pm
+++ b/fml/lib/FML/Command/Admin/newml.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: newml.pm,v 1.10 2002/01/27 15:04:36 fukachan Exp $
+# $FML: newml.pm,v 1.11 2002/02/03 12:11:55 fukachan Exp $
#
package FML::Command::Admin::newml;
@@ -51,11 +51,10 @@ sub process
{
my ($self, $curproc, $command_args) = @_;
my $config = $curproc->{ 'config' };
- my $main_cf = $curproc->{ 'main_cf' };
my ($ml_name, $ml_domain, $ml_home_prefix, $ml_home_dir) =
$self->_get_domain_info($curproc, $command_args);
my $params = {
- executable_prefix => $main_cf->{ executable_prefix },
+ executable_prefix => $curproc->executable_prefix(),
ml_name => $ml_name,
ml_domain => $ml_domain,
ml_home_prefix => $ml_home_prefix,
@@ -75,10 +74,9 @@ sub process
mkdirhier( $ml_home_dir, $config->{ default_dir_mode } || 0755 );
- my $default_config_dir = $main_cf->{ 'default_config_dir' };
-
+ my $template_dir = $curproc->template_files_dir_for_newml();
for my $file (qw(config.cf include include-ctl)) {
- my $src = File::Spec->catfile($default_config_dir, $file);
+ my $src = File::Spec->catfile($template_dir, $file);
my $dst = File::Spec->catfile($ml_home_dir, $file);
print STDERR "installing $dst\n";
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm
index 95abd8ec..1689e203 100644
--- a/fml/lib/FML/Process/Utils.pm
+++ b/fml/lib/FML/Process/Utils.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Utils.pm,v 1.9 2002/02/02 15:18:00 fukachan Exp $
+# $FML: Utils.pm,v 1.10 2002/02/03 12:11:55 fukachan Exp $
#
package FML::Process::Utils;
@@ -152,7 +152,7 @@ return the default domain defined in /etc/fml/main.cf.
# Descriptions: return the default domain defined in /etc/fml/main.cf.
# Arguments: OBJ($curproc) STR($domain)
# Side Effects: none
-# Return Value: HASH_ARRAY
+# Return Value: STR
sub default_domain
{
my ($curproc, $domain) = @_;
@@ -162,6 +162,44 @@ sub default_domain
}
+=head2 executable_prefix()
+
+return executable prefix such as "/usr/local".
+
+=cut
+
+
+# Descriptions: return the path for executables
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub executable_prefix
+{
+ my ($curproc) = @_;
+ my $main_cf = $curproc->{ __parent_args }->{ main_cf };
+
+ return $main_cf->{ executable_prefix };
+}
+
+
+=head2 template_files_dir_for_newml()
+
+=cut
+
+
+# Descriptions: return the path where template files used in "newml" method exist
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub template_files_dir_for_newml
+{
+ my ($curproc) = @_;
+ my $main_cf = $curproc->{ __parent_args }->{ main_cf };
+
+ return $main_cf->{ default_config_dir };
+}
+
+
=head2 ml_home_prefix([domain])
return $ml_home_prefix in main.cf.
@@ -218,6 +256,11 @@ sub __ml_home_prefix_from_main_cf
+# Descriptions: search virtual domain in $virtual_maps.
+# return $ml_home_prefix for the virtual domain if found.
+# Arguments: HASH_REF($main_cf) STR($virtual_domain) ARRAY_REF($virtual_maps)
+# Side Effects: none
+# Return Value: STR
sub __ml_home_prefix_search_in_virtual_maps
{
my ($main_cf, $virtual_domain, $virtual_maps) = @_;
@@ -246,7 +289,7 @@ sub __ml_home_prefix_search_in_virtual_maps
}
}
- return undef;
+ return '';
}