Sample Program i wrote:
use Getopt::Long;
my $delay;
my $action_script;
my $action_task;
my $customer_id;
my $resource_id;
my $event_state;
my $situation_name;
my $NOARGS=78;
my $action_script;
my $action_task;
my $customer_id;
my $resource_id;
my $event_state;
my $situation_name;
my $NOARGS=78;
GetOptions (
"d|delay=i" => \$delay,
"scriptname=s" => \$action_script,
"a|action=i" => \$action_task,
"c|cus|customer=s" => \$customer_id,
"r|resource=s" => \$resource_id,
"s|state=s" => \$event_state,
"sit|situation=s" => \$situation_name
);
if(!(defined $delay) || !(defined $action_script) || !(defined $action_task) || !(defined $customer_id) || !(defined $resource_id) || !(defined $event_state) || !(defined $situation_name))
{
usage();
exit $NOARGS;
}
"d|delay=i" => \$delay,
"scriptname=s" => \$action_script,
"a|action=i" => \$action_task,
"c|cus|customer=s" => \$customer_id,
"r|resource=s" => \$resource_id,
"s|state=s" => \$event_state,
"sit|situation=s" => \$situation_name
);
if(!(defined $delay) || !(defined $action_script) || !(defined $action_task) || !(defined $customer_id) || !(defined $resource_id) || !(defined $event_state) || !(defined $situation_name))
{
usage();
exit $NOARGS;
}
sub usage
{
print("usage : $0 -delay [delay]-scriptname [action_script] -action [action_task] -customer [customer_id] -resource [resource_id] -state [event_state] -situation [situation_name]\n") ;
}
{
print("usage : $0 -delay [delay]-scriptname [action_script] -action [action_task] -customer [customer_id] -resource [resource_id] -state [event_state] -situation [situation_name]\n") ;
}
No comments:
Post a Comment