title: Node module is undefined when required
body: <p>I'm getting a very odd error when I try to require a node module.  To illustrate the problem here is the code I am trying to require:</p>
  
  <pre><code>module.exports = (function(){
    this.say = function(message) {
      console.log(message);
    }
  })();
  </code></pre>
  
  <p>Now when I require this module I get 'Cannot read property 'say' of undefined when I try to use it as follows:</p>
  
  <pre><code>var person = require('./Person.js')
  person.say('Hello World!');
  </code></pre>
  
  <p>And yet, if I define the module as follows it works fine ...</p>
  
  <pre><code>module.exports = {
      say : function(message) {
         console.log(message);
      }
  };
  </code></pre>
  
  <p>I even tried this notation that also worked ...</p>
  
  <pre><code>module.exports = new Person();
  function Person(){
    this.say = function(message) {
      console.log(message);
    }
  };
  </code></pre>
  
  <p>Does anyone have any idea why the first notation doesn't work properly?</p>