in reply to A question of design
I think the final design makes the most sense. It separates the functionality for deciding which handler to use from writing out the object.
Another way to handle it is store the state in the producer. Then have separate methods to fetch the mime_type and to write out the document.
$producer->start(@args); my $type = $producer->mime_type(); $product->generate();
|
|---|