"Santiago Hirschfeld" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi everyone,
>
> I'm pretty new to perl and i'm doing a program to organize music, I'd
> like to make a plugin system for the file formats, so i can just use
> the formats y ussually have, and not include a long list of "use" in
> my main program.
> I was thinking in create modules in MyProg/AudioFormats/ with names as
> Ogg.pm and then call them automattically in my main program (which
> should check for all existing files and then create a hash containing
> the extentions the plugin module manages and the module name (like
> ('ogg'  => 'Ogg', 'mp3' => 'Mp3',) )  and use some standard subs in
> every module (get_file_tag, get_know_extentions, set_file_tag).
> My idea is to call the right get_file_tag for every file, so
> MyProg::AudioFormats::Ogg::get_file_tag is called when an ogg file is
> used. And that is  what i don't know how to do =)
>

What you describe is called a "Class Factory" and you may be able to use a
module or two from CPAN, the one that immediately comes to mind is the aptly
named "Class::Factory."

http://search.cpan.org/~cwinters/Class-Factory-1.03/lib/Class/Factory.pm

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to