ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Convert-CD/lib/Convert/CD.pm
Revision: 1.9
Committed: Thu Mar 3 17:49:58 2005 UTC (21 years, 6 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 =head1 NAME
2
3 Convert::CD - import/export/represent various cd image file formats
4
5 =head1 SYNOPSIS
6
7 use Convert::CD;
8
9 # to be done
10
11 =head1 DESCRIPTION
12
13 Kidding?
14
15 =head2 Convert:CD METHODS
16
17 This class represents a full CD image, which can consist of one or more
18 files. While track layout and TOC data is stored in this class, to
19 read/write TOC files you need a Convert::CD::TOCFile.
20
21 =over 4
22
23 =cut
24
25 package Convert::CD;
26
27 $VERSION = 0.01;
28
29 =item new param => value...
30
31 Create a new Convert::CD object.
32
33 my $cd = new path => "/tmp/mycd.bin";
34
35 =cut
36
37 use Convert::CD::Track;
38
39 sub new {
40 my $class = shift;
41 my $self = bless {
42 track => [], # an array of tracks, track #1 is in index 0
43 @_,
44 }, $class;
45
46 $self;
47 }
48
49 =item $cd->append_track(param => value...)
50
51 Appends a new track to the image. Same parameters as Convert::CD::Track->new.
52
53 =cut
54
55 sub append_track {
56 my ($self, %arg) = @_;
57
58 push @{$self->{track}}, Convert::CD::Track->new (%arg);
59 }
60
61 =item $cd->as_string
62
63 Returns a multi-line, textual description of the CD Image.
64
65 =cut
66
67 sub as_string {
68 my ($self) = @_;
69 my $r;
70
71 $r .= "Image Path: $self->{path}\n";
72
73 for my $idx (1 .. @{$self->{track}}) {
74 $r .= sprintf "Track %02d: %s\n", $idx, $self->{track}[$idx - 1]->as_string;
75 }
76
77 $r;
78 }
79
80 =item $cd->track ([$idx])
81
82 Returns the track with the given index, or, if no index is given, all the
83 tracks of the CD (or the number of tracks in scalar context). The first
84 track is track #1.
85
86 =cut
87
88 sub track {
89 my ($self, $idx) = @_;
90
91 @_ > 1 ? $self->{track}[$idx - 1] : @{$self->{track}};
92 }
93
94 1;
95
96 =back
97
98 =head1 AUTHOR
99
100 Marc Lehmann <schmorp@schmorp.de>
101
102 =cut
103