title: Intermediate Shell Class
body: <p>I have a CakePHP project with three shell scripts that will be run as cron jobs. The output of these cron jobs will be useful for debugging. We've decided to email this output to the support team. My plan is to create a class <code>CronShell</code> that extends <code>AppShell</code> then extend <code>CronShell</code> for any scripts that will be run as cron jobs. Here's the <code>CronShell</code> class:</p>
  
  <pre><code>class CronShell extends AppShell {
      private $_messages = array();
  
      public function out($message=null, $newlines=1, $level=Shell::NORMAL) {
          parent::out($message, $newlines, $level);
          $this-&gt;_messages[] = $message;
      }   
  
      public function __destruct() {
          App::uses('CakeEmail', 'Network/Email');
          $email = new CakeEmail('default');
          $email-&gt;to(Configure::read('support.addresses'));
          $email-&gt;subject(get_class($this).' output');
          $email-&gt;send(implode("\n", $this-&gt;_messages));
      }
  }
  </code></pre>
  
  <p>I have a simple test implementation that inherits from <code>CronShell</code>:</p>
  
  <pre><code>class TestShell extends CronShell {
  
      public function startup() {
          // Omit the startup message.
          return;
      }   
  
      public function main() {
          $this-&gt;out('test');
          $this-&gt;out('out');
          $this-&gt;out('the');
          $this-&gt;out('class');
      }
  }
  </code></pre>
  
  <p>But the output is:</p>
  
  <pre><code>PHP Fatal error:  Class 'CronShell' not found in...
  </code></pre>
  
  <p>How do I make <code>TestShell</code> aware of <code>CronShell</code>?</p>