Changeset 50 for LATMOS-Accounts


Ignore:
Timestamp:
04/25/09 23:55:25 (15 years ago)
Author:
nanardon
Message:
  • add L::A::create_synchro()
Location:
LATMOS-Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/bin/la-sync

    r41 r50  
    4646my $LA = LATMOS::Accounts->new($config); 
    4747 
    48 # TODO LATMOS::Accounts::Synchro creation can be done by LATMOS::Account 
    49 my $labfrom = $from ? $LA->base($from) : $LA->default_base; 
    50  
    51 my @labto = map { $LA->base($_) } 
    52     @to 
    53         ? @to 
    54         : ($LA->config_sync_base($from 
    55                 ? $from 
    56                 : $LA->default_base_name 
    57         ) 
    58 ); 
    59  
    60 my $sync = LATMOS::Accounts::Synchro->new($labfrom, [ @labto ]); 
     48my $sync = $LA->create_synchro($from, [ @to ]); 
    6149$sync->load_dest and return; 
    6250$sync->process or warn "Sync has failed\n"; 
  • LATMOS-Accounts/lib/LATMOS/Accounts.pm

    r49 r50  
    66use base qw(Config::IniFiles); 
    77use LATMOS::Accounts::Bases; 
     8use LATMOS::Accounts::Synchro; 
    89 
    910our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
     
    8081}  
    8182 
     83sub create_synchro { 
     84    my ($self, $from, $to, %options) = @_; 
     85 
     86    my $labfrom = $from ? $self->base($from) : $self->default_base; 
     87 
     88    my @labto = map { $self->base($_) } 
     89        @{ $to || []} 
     90        ? @{ $to } 
     91        : ($self->config_sync_base($from 
     92                ? $from 
     93                : $self->default_base_name)); 
     94 
     95    my $sync = LATMOS::Accounts::Synchro->new( 
     96        $labfrom, [ @labto ], 
     97        state_file => $self->val('_default_', 'state_file'), 
     98    ); 
     99} 
     100 
     101 
    821021; 
    83103 
Note: See TracChangeset for help on using the changeset viewer.