Changeset 29379

Show
Ignore:
Timestamp:
20.10.2014 10:08:50 (5 years ago)
Author:
kjdon
Message:

implementing statsfile option which is used by the depositor

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/inexport.pm

    r29370 r29379  
    254254    $out->autoflush(1); 
    255255    $self->{'out'} = $out; 
     256 
     257    my $statsfile = $self->{'statsfile'}; 
     258    if ($statsfile !~ /^(STDERR|STDOUT)$/i) { 
     259    open (STATSFILE, ">$statsfile") || 
     260        (&gsprintf(STDERR, "{common.cannot_open_output_file}: $!\n", $statsfile) && die); 
     261    $statsfile = 'inexport::STATSFILE'; 
     262    $self->{'close_stats'} = 1; 
     263    } 
     264    $statsfile->autoflush(1); 
     265    $self->{'statsfile'} = $statsfile; 
    256266 
    257267    # @ARGV should be only one item, the name of the collection 
     
    10371047  my $out           = $self->{'out'}; 
    10381048  my $faillogname   = $self->{'faillogname'}; 
     1049  my $statsfile     = $self->{'statsfile'}; 
    10391050  my $gli           = $self->{'gli'}; 
    10401051 
     
    10441055  &gsprintf($out, "*********************************************\n"); 
    10451056 
    1046   &plugin::write_stats($pluginfo, 'STDERR', $faillogname, $gli); 
     1057  &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli); 
    10471058} 
    10481059# generate_statistics() 
     
    10571068  close OUT if $self->{'close_out'}; 
    10581069  close FAILLOG if $self->{'close_faillog'}; 
     1070  close STATSFILE if $self->{'close_statsfile'}; 
    10591071} 
    10601072# deinit()