title: Perl class naming convention
body: <p>Let's say I create a class named <code>Bar</code>. The file <code>Bar.pm</code> starts</p>
  
  <pre><code>package Bar;
  </code></pre>
  
  <p>To avoid colliding with other <code>Bar</code> classes, I put the file in a subdirectory <code>Foo</code>. So now, when I use the class, I have to write</p>
  
  <pre><code>use Foo::Bar;
  </code></pre>
  
  <p>My question is, <strong>do I need to change the name of the class to <code>Foo::Bar</code>?</strong> In other words, do I need to change the first line of <code>Bar.pm</code> to</p>
  
  <pre><code>package Foo::Bar;
  </code></pre>
  
  <p>? The problem is, if I do this, I now have to refer to the class as <code>Foo::Bar</code> everywhere, e.g.</p>
  
  <pre><code>my $obj = Foo::Bar-&gt;new();
  Foo::Bar-&gt;doClassMethod();
  </code></pre>
  
  <p>which is annoying (the same problem was discussed in <a href="https://stackoverflow.com/questions/1430548/how-can-i-call-a-perl-class-with-a-shorter-name">this question</a>), especially since I am fond of class methods.</p>