Should exist, but probably doesn't (2)

Eric Wilhelm scratchcomputing at gmail.com
Thu Dec 7 22:48:29 GMT 2006


# from ti at lemonia.org
# on Thursday 07 December 2006 11:53 am:

>Now, what I think I want is something along the lines of this model:
>
>(in the module that does something-expensive)
>
>sub convert_to_mp3 {
>    my ($self, $filename) = @_;
>    procrastinate($self, "_actually_convert_to_mp3");
>}
>
>sub _actually_convert_to_mp3 {
>    my ($class, $filename) = @_;
>    # actually transcode $filename
>}

You might look at my MultiTask::Manager/MultiTask::Minion 
implementation.  I'm using this is dotReader to install iterators 
(minions) and run them in the GUI idle time.

  http://svn.dotreader.com/svn/dotreader/trunk/lib/MultiTask/

(Yes, it's only in our svn and dotReader dist right now, but I will 
eventually break that out into its own CPAN dist.)

It's similar in spirit to POE, and may or may not be a better way to go 
in your situation.  Mainly, I just wasn't terribly excited about 
rewriting/wrapping code to be specific to POE, making everything work 
within the POE framework, using constant array slices to get method 
parameters, etc.  That, and it wasn't immediately clear to me how to 
drive the POE event loop from Wx (though I now think that wouldn't be 
too terribly difficult, but still probably won't go to the effort to do 
the integration.)  Where it seems to me that POE dictates your program 
architecture (to fit the framework), MT::M only appears where it is 
needed and doesn't have to boot.  Your minions can even contain 
managers which contain minions.

--Eric
-- 
"Time flies like an arrow, but fruit flies like a banana."
--Groucho Marx
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------



More information about the london.pm mailing list