=head1 NAME Convert::CD::TOCFile - base class to represent TOC files. =head1 SYNOPSIS use Convert::CD::TOCFile; # to be done =head1 DESCRIPTION A TOCFile object is used to represent file-format-specific information about an image, such as image or track filenames and read/write functionality for toc files. =head2 Convert:CD::TOCFile METHODS =over 4 =cut package Convert::CD::TOCFile; $VERSION = 0.01; use File::Spec; use Carp; use Convert::CD; use base Convert::CD::TOCFile; =item new param => value... Create a new Convert::CD::TOCFile object. Parameters: path the base image filename =cut sub new { my $class = shift; my $self = bless { @_, }, $class; $self; } =item $toc->find_tocfile suffixes.. Try to find a tocfile by probing the given suffixes. =cut sub find_tocfile { my ($self, @ext) = @_; my $stem = $self->{path}; $stem =~ s/\.\S{2,4}$//; for (@ext) { return "$stem.$_" if -f "$stem.$_"; } (); } =item $cd = $toc->read Read the TOC file, returns a new Convert::CD object. =item $toc->write ($cd) Write the TOC File using the information in the given Convert::CD object. =cut sub read { my ($self) = @_; my $cd = new Convert::CD path => $self->{path} or croak "unable to create a new Convert::CD object"; $self->_read ($cd); $cd; } sub write { my ($self, $cd) = @_; $self->_write ($cd); } # abstract methods sub _read { my ($self, $cd) = @_; croak sprintf "reading %s toc files is not supported", ref $self; } sub _write { my ($self, $cd) = @_; croak sprintf "writing %s toc files is not supported", ref $self; } 1; =back =head1 AUTHOR Marc Lehmann =cut