=head1 NAME Convert::CD - import/export/represent various cd image file formats =head1 SYNOPSIS use Convert::CD; # to be done =head1 DESCRIPTION Kidding? =head2 Convert:CD METHODS This class represents a full CD image, which can consist of one or more files. While track layout and TOC data is stored in this class, to read/write TOC files you need a Convert::CD::TOCFile. =over 4 =cut package Convert::CD; $VERSION = 0.01; =item new param => value... Create a new Convert::CD object. my $cd = new path => "/tmp/mycd.bin"; =cut use Convert::CD::Track; sub new { my $class = shift; my $self = bless { track => [], # an array of tracks, track #1 is in index 0 @_, }, $class; $self; } =item $cd->append_track(param => value...) Appends a new track to the image. Same parameters as Convert::CD::Track->new. =cut sub append_track { my ($self, %arg) = @_; push @{$self->{track}}, Convert::CD::Track->new (%arg); } =item $cd->as_string Returns a multi-line, textual description of the CD Image. =cut sub as_string { my ($self) = @_; my $r; $r .= "Image Path: $self->{path}\n"; for my $idx (1 .. @{$self->{track}}) { $r .= sprintf "Track %02d: %s\n", $idx, $self->{track}[$idx - 1]->as_string; } $r; } =item $cd->track ([$idx]) Returns the track with the given index, or, if no index is given, all the tracks of the CD (or the number of tracks in scalar context). The first track is track #1. =cut sub track { my ($self, $idx) = @_; @_ > 1 ? $self->{track}[$idx - 1] : @{$self->{track}}; } 1; =back =head1 AUTHOR Marc Lehmann =cut