source: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Basessynchro.pm

Last change on this file was 2440, checked in by nanardon, 4 years ago

Fix: syntax error introduced by previous commit

File size: 1.9 KB
RevLine 
[861]1package LATMOS::Accounts::Task::Basessynchro;
2
3use strict;
4use warnings;
5use base qw(LATMOS::Accounts::Task);
6use LATMOS::Accounts;
7use LATMOS::Accounts::Log;
8
[1023]9=head1 NAME
10
11LATMOS::Accounts::Task::Basessynchro - Synchronize bases
12
13=head1 DESCRIPTION
14
15This module is responsible of the copy of object from main base to others
16
17=cut
18
[1824]19sub order { 2 }
20
[2127]21sub runDelay { 900 }
22
[861]23sub run {
24    my ($self) = @_;
[2440]25    my $LA = $self->LA or do {
[861]26        la_log LA_ERR, "Cannot instantiate LA";
27        return 1;
28    };
29
30    if (my $mail = $LA->val($self->{syncname} || $LA->default_synchro_name, 'maillog')) {
31        la_set_log(mail => $mail);
32    }
33
34    my $sync = $LA->create_synchro(
35        $self->{syncname} || $LA->default_synchro_name,
36        test     => $self->{test},
37    ) or do {
38       la_log LA_ERR, "cannot create sync object";
[1204]39       return;
[861]40    };
41
42    $sync->load_dest and do {
43        la_log LA_ERR, "Cannot load destination";
[1204]44        return;
[861]45    };
46
47    $sync->process() or do {
48        la_log LA_ERR, "Sync has failed\n";
[1204]49        return;
[861]50    };
[1204]51
52    return 1;
[861]53}
54
[1206]55sub reset_savepoint {
[1205]56    my ($self) = @_;
[2440]57    my $LA = $self->LA or do {
[1205]58        la_log LA_ERR, "Cannot instantiate LA";
59        return;
60    };
61    my $sync = $LA->create_synchro(
62        $self->{syncname} || $LA->default_synchro_name,
63        test     => $self->{test},
64    ) or do {
65       la_log LA_ERR, "cannot create sync object";
66       return;
67    };
68
69
[1206]70    $sync->reset_savepoint
[1205]71}
72
[861]731;
[1023]74
75=head1 SEE ALSO
76
77L<LATMOS::Accounts>, L<LATMOS::Accounts::Bases>
78
79=head1 AUTHOR
80
81Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
82
83=head1 COPYRIGHT AND LICENSE
84
85Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS
86
87This library is free software; you can redistribute it and/or modify
88it under the same terms as Perl itself, either Perl version 5.10.0 or,
89at your option, any later version of Perl 5 you may have available.
90
91=cut
Note: See TracBrowser for help on using the repository browser.