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

# 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 root 1.8 use Convert::CD::Track;
38    
39 root 1.1 sub new {
40     my $class = shift;
41 root 1.4 my $self = bless {
42     track => [], # an array of tracks, track #1 is in index 0
43 root 1.2 @_,
44     }, $class;
45 root 1.4
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 root 1.3 }
60    
61 root 1.4 =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 root 1.5 =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 root 1.6 }
93    
94 root 1.1 1;
95    
96     =back
97    
98     =head1 AUTHOR
99    
100 root 1.9 Marc Lehmann <schmorp@schmorp.de>
101 root 1.1
102     =cut
103