AEAE::Service - Exposes all service availables for managing an AEAE::Command


AEAE documentation  | view source Contained in the AEAE distribution.

Index


NAME

Top

AEAE::Service - Exposes all service availables for managing an AEAE::Command

AUTHOR

Top

jerome@eteve.net

DEPENDS

Top

This module requires Data::UUID, Carp

SYNOPSIS

Top

my $ticket = AEAE::Service->launchCommand('AEAE::Command', 'param1', 'param2');

print "\nTicket : ".$ticket."\n";

while(1){ sleep(1); my $r = AEAE::Service->checkTicket($ticket);

    print "Check : ".$r."\n";

    if( $r  >= 100 ){ last ; }
}







my $std = AEAE::Service->getSTDOUT($ticket);

print "STDOUT: ".$std;

AEAE::Service->cleanTicket($ticket);

METHODS

Top

launchCommand

Launch the given command and return a ticket.

Usage:

    my $cmd = 'AEAE::Command' ; # or any subclass of this.
    my $ticket = AEAE::Service->launchCommand($cmd, $arg1 , $arg2 ...);

$arg1, $arg2 ... are given to the command as arguments.

checkTicket

Given a ticket, return the pc of advancement of the corresponding command.

If pc >= 100, that means the command is over !

Usage:

    my $ticket = ... ; # A valid ticket
    my $pc = AEAE::Service->checkTicket($ticket);

getSTDOUT

Returns the STDOUT of the command. Wait the command to end to have the real STDOUT :)

Usage: my $ticket = ... ; my $stdout = AEAE::Service->getSTDOUT($ticket);

getSTDERR

Same as getSTDOUT but for STDERR :)

getError

If an error occured in the execution of the command, returns the error string. Else return an empty string.

getErrorMessage

Gets only the message associated with the error (without the call stack). Returns empty string if no error occured.

killTicket

Abort the command corresponding to the ticket.

Usage :

    my $ticket = ... ;
    AEAE::Service->killTicket($ticket);

Returns: the STDOUT of the killed command.

cleanTicket

Clean the ressources associated with the ticket. Use it before throwing ticket to rubbish to avoid ressource starvation.

    my $ticket = ... ; # A valid ticket
    AEAE::Service->cleanTicket($ticket);
    $ticket = undef ; # Ticket is not valid anymore.





AEAE documentation  | view source Contained in the AEAE distribution.