title: this._get is not a function - javascript oop and prototypes
body: <p>I'm using something similar to NodeJS called bondi, it's build on the Firefox js engine.. Basically i'm getting this error and I believe it's due to the way i'm referencing "this" in the .Get function below.</p>
  
  <p>Basically there is a tool called SFtpClient. It has the method of "Get", to list the contents of a folder, but I want to change the prototype for this with a drop in include file. I need to change it so that it 
  a/ retries several times when it fails, and b/ it has a recursive folder listing function.</p>
  
  <p>So I used the prototype to change it - moved .Get to ._Get.</p>
  
  <p>Can anyone see why I would be getting the error: </p>
  
  <pre><code>Jan 23 04:51:34 beta bondi: === this._Get is not a function --- Prio(6) Result(0x0) File(/home/nwo/approot/include/sftpclientenh
  </code></pre>
  
  <p>when I run the code below?
  Thanks</p>
  
  <pre><code>SFtpClient.prototype._Get = SFtpClient.prototype.Get;
  SFtpClient.prototype.Get = function(Folder, Retries){
  
      //defaults
      if(!Retries) Retries = 5;
      if(!Folder) Folder = "~/";
  
      //vars
      var FileListing = [];
  
      var connect = function(){ 
          //TODO JRF 19.01.2012 : re-enable this when bondi is fixed
          // this.HomeDirectory.replace(/\/?$/, "/");
          FileListing = this._Get(Folder);
  
          return true;
      }
  
      var i = 1;
      do{
         var res = false;
         try {
          res = connect();
         }catch(e){
             Debug.LogInfo(e.message); 
         }
         i++;
         Server.Sleep(i*2000);
      } while(res==false &amp;&amp; i &lt; Retries);
  
      return FileListing;
  }
  </code></pre>