Bonjour ,
mon problème auquel je me casse la tête est le suivant :
j'ai un script principal sur un serveur je contact ce script principal a l'aide de SOAP:Lite et je lui demande d'executer un module X .
le problème et que ce module s'execute pas au premièr appel mais s'execute a tout les suivant et j'y comprends vraiement rien !!
le shémas et ainsi
Client ---------SOAP--------> agent ------- Require module.pm-----> resultat ;
agent :
sub getinfo
{
# Module name to execute .
my (@t) = @_;
my $fichier = $t[1].".pm";
# A small print
print "$t[1] at ".localtime(time)."\n";
# Check if it's the right object name
if(-e $fichier)
{
# Execute
require $fichier;
# Get result
my ($status, @info) = $t[1]->request();
}
else
{
# Module doesn't exists
return 4,"doesnt exist !";
}
}
1;
et le module est :
#- TriggerList.pm
#- Copyright (c) 2008
package triggerlist;
###########################################################
# Imports #
###########################################################
use ModCC::ccadmin2;
use strict;
###########################################################
# Request #
###########################################################
sub request
{
print "--> Getting Triggers list begins..." ;
my $worker;
my $result;
my $osef;
my @ret = ();
$worker = new ModCC::ccadmin2();
my ($status, @voblist) = $worker->getVOBList();
print "\[";
for(my $i=0;$i<@voblist;$i++)
{
print " Looking for triggers in vob \"$voblist[$i]\" " ;
($osef,$result) = $worker->getTrigger($voblist[$i]);
push(@ret, tri($result, $voblist[$i]));
}
print "\]" ;
my $taille = @ret/10;
print "--> Work ends : triggers list will be sent..." ;
return $status,@ret;
}
###########################################################
# Tri #
###########################################################
sub tri
{
my $string = shift;
my $vob = shift;
my @rep = ();
my @data = ();
my $k=0;
$string =~ s/trigger type/~~trigger type/g;
my @data = split(/~~/,$string);
shift(@data);
for(my $i=0;$i<@data;$i++)
{
print "\." ;
$data[$i] =~ s/\n//g;
$data[$i] =~ s/\t//g;
$data[$i] =~ s/\r//g;
$data[$i] =~ s/ / /g;
$data[$i] =~ m/trigger type "([^"]*)" ([^"]*) "([^"]*)" owner: [^ ]* group: [^ ]* (.*)((post|pre)-.*?)( action.*?))( action.*?))?( action.*?))?( excluded users: (.*))?$/;
$rep[$k++] = $vob;
$rep[$k++] = $1; #name of the trigger
$rep[$k++] = $2; #date & creator
$rep[$k++] = $3; #comment
$rep[$k++] = $4; #all info
$rep[$k++] = $5; #post or pre operation
$rep[$k++] = $8; #first action
$rep[$k++] = $10; #second action
$rep[$k++] = $12; #third and more actions in case
$rep[$k++] = $14; #excluded users;
}
return @rep;
}
}
1;