ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Convert-CD/lib/Convert/CD.pm
Revision: 1.7
Committed: Tue Jun 10 15:54:26 2003 UTC (23 years, 3 months ago) by root
Branch: MAIN
Changes since 1.6: +0 -130 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3 root 1.2 Convert::CD - import/export/represent various cd image file formats
4 root 1.1
5     =head1 SYNOPSIS
6    
7     use Convert::CD;
8    
9     # to be done
10    
11     =head1 DESCRIPTION
12    
13     Kidding?
14    
15 root 1.3 =head2 Convert:CD METHODS
16    
17 root 1.4 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 root 1.1
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 root 1.3 my $cd = new path => "/tmp/mycd.bin";
34 root 1.1
35     =cut
36    
37     sub new {
38     my $class = shift;
39 root 1.4 my $self = bless {
40     track => [], # an array of tracks, track #1 is in index 0
41 root 1.2 @_,
42     }, $class;
43 root 1.4
44     $self;
45     }
46    
47     =item $cd->append_track(param => value...)
48    
49     Appends a new track to the image. Same parameters as Convert::CD::Track->new.
50    
51     =cut
52    
53     sub append_track {
54     my ($self, %arg) = @_;
55    
56     push @{$self->{track}}, Convert::CD::Track->new (%arg);
57 root 1.3 }
58    
59 root 1.4 =item $cd->as_string
60    
61     Returns a multi-line, textual description of the CD Image.
62    
63     =cut
64    
65     sub as_string {
66     my ($self) = @_;
67     my $r;
68    
69     $r .= "Image Path: $self->{path}\n";
70    
71     for my $idx (1 .. @{$self->{track}}) {
72     $r .= sprintf "Track %02d: %s\n", $idx, $self->{track}[$idx - 1]->as_string;
73     }
74    
75     $r;
76     }
77    
78 root 1.5 =item $cd->track ([$idx])
79    
80     Returns the track with the given index, or, if no index is given, all the
81     tracks of the CD (or the number of tracks in scalar context). The first
82     track is track #1.
83    
84     =cut
85    
86     sub track {
87     my ($self, $idx) = @_;
88    
89     @_ > 1 ? $self->{track}[$idx - 1] : @{$self->{track}};
90 root 1.6 }
91    
92 root 1.1 1;
93    
94     =back
95    
96     =head1 AUTHOR
97    
98     Marc Lehmann <pcg@goof.com>
99    
100     =cut
101