The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Astro::FITS::CFITSIO::Simple::PrintStatus - generate a progress status update

DESCRIPTION

INTERNAL USE ONLY! No warranty, may change, etc.

Methods

new
  $status = Astro::FITS::CFITSIO::Simple::PrintStatus->new( $what );

Create a new object. $what may be one of the following:

SCALAR

If this is non-zero, a progress indicator is written to STDERR. If Term::ProgressBar is available, that is used, else a simple percentile is output. If this is zero, returns undef.

GLOB

If it's a glob, it's assumed to be a filehandle glob, and output is written to that filehandle.

CODEREF

If it's a code reference, it is called with three arguments

  rows read
  total number of rows
OBJECT

If it's an object, and it has print() and flush() methods, it'll call those as appropriate.

start
  $status->start( $nrows );

This preps the output and indicates the number of rows that will be written.

update
  $status->update( $rows_read );

This will cause output to be generated. It returns the number of rows that will cause an actual change in the output. It is usually used as such:

  $next_update = 0;
  $ps->start();
  for ( 0..$nmax )
  {
    # do stuff

    $next_update = $ps->update( $_ )
      if $_ >= $next_update;
  }
  $ps->finish
    if $nmax >= $next_update;
finish
  $status->finish;

This should be called after all of the rows have been written.

1;