Siebel-Srvrmgr
view release on metacpan or search on metacpan
lib/Siebel/Srvrmgr/Daemon/Light.pm view on Meta::CPAN
=head1 SYNOPSIS
use Siebel::Srvrmgr::Daemon::Light;
my $daemon = Siebel::Srvrmgr::Daemon::Light->new(
{
time_zone => 'America/Sao_Paulo',
connection => $my_connection,
commands => [
Siebel::Srvrmgr::Daemon::Command->new(
command => 'load preferences',
action => 'LoadPreferences'
),
Siebel::Srvrmgr::Daemon::Command->new(
command => 'list comp type',
action => 'ListCompTypes',
params => [$comp_types_file]
),
Siebel::Srvrmgr::Daemon::Command->new(
command => 'list comp',
action => 'ListComps',
params => [$comps_file]
),
Siebel::Srvrmgr::Daemon::Command->new(
command => 'list comp def',
action => 'ListCompDef',
params => [$comps_defs_file]
)
]
}
);
$daemon->run;
=head1 DESCRIPTION
This is a subclass of L<Siebel::Srvrmgr::Daemon> used to execute the C<srvrmgr> program in batch mode. For a better understanding of what batch mode means,
check out srvrmgr documentation.
This class is recomended for cases where it is not necessary to run several commmands through srvrmgr in a short period of time because in batch mode it will
connect to the Siebel Gateway, execute the commands configured and exit, avoiding keeping a connection opened for a long time. For UNIX-like OS, this class
would be a good choice for using with Inetd and Xinetd daemons.
This class is also highly recommended for OS plataforms like Microsoft Windows where IPC is not reliable enough, since this class uses C<system> instead of
L<IPC::Open3>.
Since version 0.21, this class does not overrides anymore the parent class method C<shift_command>. Some attention is required is this matter, since a instance of
Siebel::Srvrmgr::Daemon::Light will not maintain configuration previously loaded with C<load preferences> command. Be sure to maintain this command everytime you invoke
C<run> available in the C<commands> attribute.
=cut
use Moose 2.0401;
use namespace::autoclean 0.13;
use Siebel::Srvrmgr::Daemon::ActionFactory;
use Siebel::Srvrmgr::Daemon::Command;
use Carp qw(longmess);
use File::Temp 0.2304 qw(:POSIX);
use Data::Dumper;
use Siebel::Srvrmgr;
use File::BOM 0.14 qw(:all);
use Siebel::Srvrmgr::IPC qw(check_system);
use Try::Tiny 0.27;
our $VERSION = '0.29'; # VERSION
extends 'Siebel::Srvrmgr::Daemon';
with 'Siebel::Srvrmgr::Daemon::Cleanup';
with 'Siebel::Srvrmgr::Daemon::Connection';
=pod
=head1 ATTRIBUTES
=head2 output_file
A string that represents the "/o" command line parameter of srvrmgr. It is defined internally, so it is read-only.
=cut
has output_file => (
isa => 'Str',
is => 'ro',
reader => 'get_output_file',
writer => '_set_output_file'
);
=pod
=head2 input_file
A string that represents the "/i" command line parameter of srvrmgr. It is defined internally, so it is read-only.
=cut
has input_file => (
isa => 'Str',
is => 'ro',
reader => 'get_input_file',
writer => '_set_input_file'
);
=pod
=head1 METHODS
=head2 get_output_file
Returns the content of the C<output_file> attribute.
=head2 get_input_file
Returns the content of the C<input_file> attribute.
=head2 run
This method will try to connect to a Siebel Enterprise through C<srvrmgr> connection to submit the commands and respective actions defined during object creation.
Those operations will be executed in the sequence define until all were executed once.
Beware that Siebel::Srvrmgr::Daemon uses a B<single instance> of a L<Siebel::Srvrmgr::ListParser> class to process the parsing requests, so it is not possible
to execute L<Siebel::Srvrmgr::Daemon::Command> instances in parallel.
( run in 1.794 second using v1.01-cache-2.11-cpan-364913b4093 )