App-Regather

 view release on metacpan or  search on metacpan

lib/App/Regather/Plugin/configfile.pm  view on Meta::CPAN

=cut

sub ldap_sync_add_modify {
  my $self = shift;

  my ($tt_vars, $pp, $chin, $chou, $chst, $cher);

  $self->log->cc( pr => 'debug', fm => "%s called with arguments: %s",
		  ls => [ sprintf("%s:%s",__FILE__,__LINE__), join(',', sort(keys( %{$self}))), ] ) if $self->{v} > 3;

  ### PREPARING OUTPUT RELATED VARIABLES
  my %out_paths = out_paths( cf      => $self->cf,      obj => $self->obj,
			     service => $self->service, rdn => $self->rdn, log => $self->log );
  return if ! %out_paths;
  my $out_file_pfx //= $out_paths{out_file_pfx};
  my $out_file     //= $out_paths{out_file};
  my $dir          = $out_file_pfx // $self->cf->get('service', $self->service, 'out_path');
  my $out_to       = $dir . '/' . $out_file;

  $self->log->cc( pr => 'debug', fm => "%s: output directory: %s; file: %s",
		  ls => [ sprintf("%s:%s",__FILE__,__LINE__), $dir, $out_file ] ) if $self->{v} > 2;

lib/App/Regather/Plugin/configfile.pm  view on Meta::CPAN

  eval { $tmp_fh = File::Temp->new( UNLINK => 0, DIR => $dir ); };
  if ( $@ ) {
    $self->log->cc( pr => 'err', fm => "%s: File::Temp->new( DIR => %s ); service \"%s\"; err: \"%s\"",
	      ls => [ sprintf("%s:%s",__FILE__,__LINE__), $dir, $self->service, $@ ] );
    return;
  }
  $tmp_fn = $tmp_fh->filename;
  my $tt = Template->new( TRIM        => $self->cf->get(qw(core tt_trim)),
			  ABSOLUTE    => 1,
			  RELATIVE    => 1,
			  OUTPUT_PATH => $dir,
			  DEBUG       => $self->log->foreground // $self->cf->get(qw(core tt_debug)) );

  $self->log->cc( pr => 'err', fm => "%s: Template->new( OUTPUT_PATH => %s ) for service %s error: %s",
	    ls => [ sprintf("%s:%s",__FILE__,__LINE__), $dir, $self->service, $! ] )
    if ! defined $tt;

  $tt->process( sprintf("%s/%s",
			$self->cf->get(qw(core tt_path)),
			$self->cf->get('service', $self->service, 'tt_file')),
		$tt_vars,
		$tmp_fh ) || do {
		  $self->log->cc( pr => 'err', fm => "%s: %s .tt process error: %s",
			    ls => [ sprintf("%s:%s",__FILE__,__LINE__), SYNST->[$self->syncstate], $tt->error ] );

lib/App/Regather/Plugin/configfile.pm  view on Meta::CPAN

=cut

sub ldap_sync_delete {
  my $self = shift;

  my ($tt_vars, $pp, $chin, $chou, $chst, $cher);

  $self->log->cc( pr => 'debug', fm => "%s: %s called with arguments: %s",
	    ls => [ sprintf("%s:%s",__FILE__,__LINE__), join(',', sort(keys( %{$self}))), ] ) if $self->{v} > 3;

  ### PREPARING OUTPUT RELATED VARIABLES
  my %out_paths = out_paths( cf      => $self->cf,      obj => $self->obj,
			     service => $self->service, rdn => $self->rdn, log => $self->log );
  return if ! %out_paths;
  my $out_file_pfx //= $out_paths{out_file_pfx};
  my $out_file     //= $out_paths{out_file};
  my $dir          = $out_file_pfx // $self->cf->get('service', $self->service, 'out_path');
  my $out_to       = $dir . '/' . $out_file;

  $self->log->cc( pr => 'debug', fm => "%s: output directory: %s; file: %s",
	    ls => [ sprintf("%s:%s",__FILE__,__LINE__), $dir, $out_file ] ) if $self->{v} > 2;



( run in 0.340 second using v1.01-cache-2.11-cpan-4e96b696675 )