App-Regather

 view release on metacpan or  search on metacpan

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

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  pod2usage(-exitval => 2, -sections => [ qw(USAGE) ]);
  exit 1;
}
 
$self->{_opt}{cf} = new
  App::Regather::Config ( filename => $self->{_opt}{config},
                          logger   => $self->{_opt}{l},
                          cli      => $self->{_opt}{cli},
                          verbose  => $self->{_opt}{v} );
 
my $cf_mode = (stat($self->{_opt}{config}))[2] & 0777;
my $fm_msg;
if ( $cf_mode & 002 || $cf_mode & 006 ) {
  $fm_msg = 'world';
} elsif ( $cf_mode & 020 || $cf_mode & 060) {
  $fm_msg = 'group';
}
if ( defined $fm_msg ) {
  $self->{_opt}{l}->cc(          pr => 'err', fm => 'config file is accessible by ' . $fm_msg);
  $self->{_opt}{l}->cc( fg => 1, pr => 'err', fm => 'config file is accessible by ' . $fm_msg);
  pod2usage(-exitval => 2, -sections => [ qw(USAGE) ]);

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

338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
close($fh) || do {
  print "close $self->cf->get(qw(core pid_file)) (opened for reading) failed: $!\n\n";
  exit 1;
};
 
if ( kill(0, $pid) ) {
  print "Doing nothing\npidfile $self->cf->get(qw(core pid_file)) of the proces with pid $pid, exists and the very process is alive\n\n";
  exit 1;
}
 
$orphaned_pid_mtime = strftime( $self->o('ts_fmt'), localtime( (stat( $self->cf->get(qw(core pid_file)) ))[9] ));
if ( unlink $self->cf->get(qw(core pid_file)) ) {
  $self->l->cc( pr => 'debug', fm => "%s:%s: orphaned %s was removed",
            ls => [ __FILE__,__LINE__, $self->cf->get(qw(core pid_file)) ] )
    if $self->o('v') > 0;
} else {
  $self->l->cc( pr => 'err', fm => "%s:%s: orphaned %s (mtime: %s) was not removed: %s",
            ls => [ __FILE__,__LINE__, $self->cf->get(qw(core pid_file)), $orphaned_pid_mtime, $! ] );
  exit 2;
}

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

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
  ( split(/=/, ( split(/,/, $self->obj->get_value('creatorsName')) )[0]) )[1] :
  'UNKNOWN';
$tt_vars->{modifiedby} =
  $self->obj->exists('modifiersName') ?
  ( split(/=/, ( split(/,/, $self->obj->get_value('modifiersName')) )[0]) )[1] :
  'UNKNOWN';
 
if ( ! $self->force && -e $out_to &&
     ( generalizedTime_to_time($self->obj->get_value('modifyTimestamp'))
       <
       (stat($out_to))[9] ) ) {
  $self->log->cc( pr => 'debug',
            fm => "%s: skip. object %s is older than target file %s, (object modifyTimestamp: %s is older than file mtime: %s",
            ls => [ sprintf("%s:%s",__FILE__,__LINE__), $self->obj->dn, $out_to,
                    strftime( "%F %T",
                              localtime(generalizedTime_to_time($self->obj->get_value('modifyTimestamp')))),
                    strftime( "%F %T", localtime((stat($out_to))[9])),
                  ] )
    if $self->{v} > 0;
  return;
}
 
### PICKING ROOT OBJECT RDN (IN OUR CASE IT IS "UID")
foreach ( reverse split(/,/, $self->obj->dn) ) {
  next if $_ !~ /^uid=/;
  $tt_vars->{uid} = ( split(/=/, $_) )[1];
  last;



( run in 1.103 second using v1.01-cache-2.11-cpan-49f99fa48dc )