Subversion Repositories havirt

Rev

Rev 10 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 11
Line 160... Line 160...
160
# new module.
160
# new module.
161
 
161
 
162
 
162
 
163
# we have to concat here since the double colon causes some interpretation problems
163
# we have to concat here since the double colon causes some interpretation problems
164
my $execute = $command . '::' . $action;
164
my $execute = $command . '::' . $action;
165
# load the module, die if it doesn't exist. Might make this an eval later
165
# load the module, die if it doesn't exist.
-
 
166
if (-f $scriptDir . "/$command.pm" ) {
166
require "$command.pm";
167
   require "$command.pm";
167
Module->import( $command ); # for require, you must manually import
168
   Module->import( $command ); # for require, you must manually import
-
 
169
} else {
-
 
170
   die "Error, I don't know the command [$command]\n";
-
 
171
}
168
 
172
 
169
if ( defined &{\&{$execute}} ) { # check if module::sub exists (ie, $command::action)
173
if ( defined &{\&{$execute}} ) { # check if module::sub exists (ie, $command::action)
170
  print &{\&{$execute}}(@ARGV); # yes, it exists, so call it with any remaining arguments
174
  print &{\&{$execute}}(@ARGV); # yes, it exists, so call it with any remaining arguments
171
} else { # method $action does not exist in module $command, so just a brief error message
175
} else { # method $action does not exist in module $command, so just a brief error message
172
  die "Error, could not find action $action for module $command\n";
176
  die "Error, could not find action [$action] for module [$command]\n";
173
} 
177
} 
174
 
178
 
175
 
179
 
176
1;
180
1;