On Apr 13, 2010, at 12:22 AM, Brice Figureau wrote:

On Mon, 2010-04-12 at 21:58 -0700, Luke Kanies wrote:
+1

The construct that includes a blank module vs. the compression module
is a bit weird. You don't necessarily need to change it, but might it
be simpler if you just had a hook that allowed you to conditionally
include it or not?

Yes, I suck at metaprogramming, but the good news is that I started
reading the book :-)

So you're proposing something like this:

module Puppet::Network::HTTP::Compression

  def include_compression
      include Puppet.features.zlib? ? Active : None
  end
  ...
end

And then use include_compression in the other classes.

I meant more something like this:

module Puppet::Network::HTTP::Compression
        def supported?
                include Puppet.features.zlib?
        end
end

class ...
include Puppet::Network::HTTP::Compression if Puppet::Network::HTTP::Compression.supported?
end

I'm not sure this is a lot better, because the caller is now exposed to that logic, but the whole stub module thing is at least weird enough that it stuck out to me.

--
Men never do evil so completely and cheerfully as when they do it from a
religious conviction. --Blaise Pascal
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to