summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-10-08 15:49:20 +0000
committerfukachan <fukachan>2001-10-08 15:49:20 +0000
commit7014349ea45684b54dacf18d232f5e5cfc861ab6 (patch)
treef102f913e96ab2d3ac8a931f31a69d8b3e1b5b3d
parent9ded9eedc2df7efe1252dd05e7206270aca328a8 (diff)
downloadfml8-7014349ea45684b54dacf18d232f5e5cfc861ab6.tar.gz
fml8-7014349ea45684b54dacf18d232f5e5cfc861ab6.tar.bz2
fml8-7014349ea45684b54dacf18d232f5e5cfc861ab6.zip
enable "loader --ctladdr" behaves as libexec/command
more debug messages modify style e.g. eval q## -> eval q{} et. al.
-rw-r--r--fml/lib/FML/Process/Switch.pm26
1 files changed, 19 insertions, 7 deletions
diff --git a/fml/lib/FML/Process/Switch.pm b/fml/lib/FML/Process/Switch.pm
index d316944c..75ceee2d 100644
--- a/fml/lib/FML/Process/Switch.pm
+++ b/fml/lib/FML/Process/Switch.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: Switch.pm,v 1.19 2001/05/28 16:17:14 fukachan Exp $
+# $FML: Switch.pm,v 1.20 2001/06/28 09:06:44 fukachan Exp $
#
package FML::Process::Switch;
@@ -96,6 +96,11 @@ sub main::Bootstrap2
print STDERR "\nsetuid is not set $< != $>\n\n" if $< != $>;
print STDERR "\nsetgid is not set $( != $)\n\n" if $( ne $);
+ # 0.2
+ if ($0 =~ /loader/) {
+ print "ARGV: @ARGV\n";
+ }
+
# 1.1 parse command line options (preliminary)
use Getopt::Long;
GetOptions(\%options, _module_specific_options($myname));
@@ -126,11 +131,13 @@ sub main::Bootstrap2
# 4. debug
if ($0 =~ /loader/) {
- eval q#
+ eval q{
require Data::Dumper; Data::Dumper->import();
+ $Data::Dumper::Varname = 'main_cf';
print Dumper( $main_cf );
sleep 3;
- #;
+ };
+ if ($@) { print STDERR $@;}
}
# 5. o.k. here we go!
@@ -301,11 +308,15 @@ sub ProcessSwitch
# Firstly, create process
# $pkg is a package name, for exampl,e "FML::Process::Distribute".
my $pkg = _module_we_use($args);
- croak("$args->{ myname } is unknown program\n") unless ($pkg);
+ unless (defined $pkg) {
+ croak("$args->{ myname } is unknown program\n");
+ }
+
+ # debug, ignore this
+ if ($0 =~ /loader/) { print "use $pkg\n"; sleep 2;}
- eval qq{ require $pkg; }; # XXX require() needs bare words.
+ eval qq{ require $pkg; $pkg->import();};
croak($@) if $@;
- $pkg->import(); # fake to use() method.
return $pkg;
}
@@ -386,7 +397,8 @@ sub _module_we_use
my $pkg = '';
if (($name eq 'fml.pl' && $args->{ options }->{ ctladdr }) ||
- $name eq 'command') {
+ $name eq 'command' ||
+ ($name eq 'loader' && $args->{ options }->{ ctladdr })) {
$pkg = 'FML::Process::Command';
}
elsif ($name eq 'fml.pl' || $name eq 'distribute' || $name eq 'loader') {