ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-CD/lib/Convert/CD/TOCFile.pm
Revision: 1.1
Committed: Mon Jun 9 20:48:29 2003 UTC (23 years, 3 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3     Convert::CD::TOCFile - base class to represent TOC files.
4    
5     =head1 SYNOPSIS
6    
7     use Convert::CD::TOCFile;
8    
9     # to be done
10    
11     =head1 DESCRIPTION
12    
13     A TOCFile object is used to represent file-format-specific information
14     about an image, such as image or track filenames and read/write
15     functionality for toc files.
16    
17     =head2 Convert:CD::TOCFile METHODS
18    
19     =over 4
20    
21     =cut
22    
23     package Convert::CD::TOCFile;
24    
25     $VERSION = 0.01;
26    
27     use File::Spec;
28     use Carp;
29    
30     use Convert::CD;
31    
32     use base Convert::CD::TOCFile;
33    
34     =item new param => value...
35    
36     Create a new Convert::CD::Cue object.
37    
38     Parameters:
39    
40     path the base image filename
41    
42     =cut
43    
44     sub new {
45     my $class = shift;
46     my $self = bless { @_, }, $class;
47    
48     $self;
49     }
50    
51     =item $toc->find_tocfile suffixes..
52    
53     Try to find a tocfile by probing the given suffixes.
54    
55     =cut
56    
57     sub find_tocfile {
58     my ($self, @ext) = @_;
59    
60     my $stem = $self->{path};
61    
62     $stem .= s/\\.\S{2,4}$//;
63    
64     for (@ext) {
65     return "$stem.$_" if -f "$stem.$_";
66     }
67    
68     ();
69     }
70    
71     =item $cd = $toc->read
72    
73     Read the TOC file, returns a new Convert::CD object.
74    
75     =item $toc->write ($cd)
76    
77     Write the TOC File using the information in the given Convert::CD object.
78    
79     =cut
80    
81     sub read {
82     my ($self) = @_;
83    
84     my $cd = new Convert::CD path => $self->{path}
85     or croak "unable to create a new Convert::CD object";
86    
87     $self->_read ($cd);
88     }
89    
90     sub write {
91     my ($self, $cd) = @_;
92    
93     $self->_write ($cd);
94     }
95    
96     # abstract methods
97     sub _read {
98     my ($self, $cd) = @_;
99    
100     croak sprintf "reading %s toc files is not supported", ref $self;
101     }
102    
103     sub _write {
104     my ($self, $cd) = @_;
105    
106     croak sprintf "writing %s toc files is not supported", ref $self;
107     }
108    
109     1;
110    
111     =back
112    
113     =head1 AUTHOR
114    
115     Marc Lehmann <pcg@goof.com>
116    
117     =cut
118