#!/usr/bin/perl use strict; use warnings; use LATMOS::Accounts; use LATMOS::Accounts::Synchro; use Getopt::Long; use Pod::Usage; =head1 NAME la-sync - Tools to synchronize base =head1 SYNOPSIS Show configured bases: la-sync [options] =cut GetOptions( 'c|config=s' => \my $config, 'help' => sub { pod2usage(0) }, 'from=s' => \my $from, 'to=s' => \my @to, ) or pod2usage(); =head1 OPTIONS =item -c|--config configfile Use this configuration file instead default =item --from basename Specify souce base to use =item --to basename Specify destination base to use, this option can be used severals times =cut my $LA = LATMOS::Accounts->new($config); # TODO LATMOS::Accounts::Synchro creation can be done by LATMOS::Account my $labfrom = $from ? $LA->base($from) : $LA->default_base; my @labto = map { $LA->base($_) } @to ? @to : ($LA->config_sync_base($from ? $from : $LA->default_base_name ) ); my $sync = LATMOS::Accounts::Synchro->new($labfrom, [ @labto ]); $sync->load_dest and return; $sync->process or warn "Sync has failed\n";