Astro-STSDAS-Table
view release on metacpan or search on metacpan
Table/Base.pm view on Meta::CPAN
$self->{file} = $file;
$self->{fh} = $fh;
# if this is open for reading, suck in the header
if ( $mode =~ /[<+]/ )
{
$self->_read_hdr;
}
1;
}
sub METHOD::ABSTRACT
{
my ($self) = @_;
my $object_class = ref($self);
my ($file, $line, $method) = (caller(1))[1..3];
my $loc = "at $file, line $line\n";
die "call to abstract method ${method} $loc";
}
sub _read_hdr { ABSTRACT METHOD @_ }
sub read_cols { ABSTRACT METHOD }
sub read_rows { ABSTRACT METHOD }
sub close
{
my $self = shift;
if ( defined $self->{fh} )
{
close $self->{fh};
$self->{fh} = undef;
}
}
1;
__END__
=pod
=head1 NAME
Astro::STSDAS::Table::Base - Base class for STSDAS Tables
=head1 SYNOPSIS
use Astro::STSDAS::Table::Base;
@isa = qw( Astro::STSDAS::Table::Base );
sub new
{
my $this = shift;
my $class = ref($this) || $this;
my $self = $class->SUPER::new();
...
bless $self, $class;
}
=head1 DESCRIPTION
B<Astro::STSDAS::Table::Base> is a base class and should be sub-classed
to derive any functionality. B<Astro::STSDAS::Table::Binary> is a
fully derived class which reads binary STSDAS tables.
B<Astro::STSDAS::Table::Base> provides several methods and requires
that the derived class provide the rest.
The base class constructor (which must be called by the derived class)
creates a hash object. The following keys are reserved, and shouldn't
be changed unless explicitly allowed.
=over 8
=item fh
An B<IO::File> object attached to the file.
=item pars
An B<Astro::STSDAS::Table::HeaderPars> object, which must be
initialized by the derived class. It is created by the base class.
=item cols
An B<Astro::STSDAS::Table::Columns> object, which must be
initialized by the derived class. It is created by the base class.
=item nrows
The number of rows in the table, if determinable. This is filled in
by the derived class.
=item file
The table's filename. This is filled in by the base class.
=item mode
The mode in which the table was opened. This is filled in by the base
class.
=back
=head1 METHODS
=head2 Methods provided by the base class
=over 8
=item new
( run in 2.665 seconds using v1.01-cache-2.11-cpan-98e64b0badf )