Audio::TagLib::FileRef::FileTypeResolver - A class for pluggable file type resolution.
This class is used to add extend Audio::TagLib's very basic file name based file type resolution.
This can be accomplished with:
package Audio::TagLib::FileRef::MyFileTypeResolver; our @ISA = qw(Audio::TagLib::FileRef::FileTypeResolver); sub createFile() { my $package = shift; my $filename = shift; if(&someCheckForAnMP3File($filename)) { my $file = Audio::TagLib::MPEG::File->new($filename); # skip DESTROY() in Perl level $file->_setReadOnly(); return $file; } return undef; } package main; Audio::TagLib::FileRef->addFileTypeResolver( Audio::TagLib::FileRef::MyFileTypeResolver->new());
Naturally a less contrived example would be slightly more complex. This can be used to plug in mime-type detection systems or to add new file types to Audio::TagLib.
This method must be overriden to provide an additional file type resolver. If the resolver is able to determine the file type it should return a valid File object; if not it should return undef.
NOTE The created file is then owned by the FileRef and should not be deleted. Deletion will happen automatically when the FileRef passes out of scope.
None by default.
Audio::TagLib
Dongxu Ma, <dongxu@cpan.org>
Copyright (C) 2005 by Dongxu Ma
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install Audio::TagLib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Audio::TagLib
CPAN shell
perl -MCPAN -e shell install Audio::TagLib
For more information on module installation, please visit the detailed CPAN module installation guide.