in reply to 1 Object 2 Files

In File.pm
package File; use File::Additional; # Your stuff here 1;

In File/Additional.pm

package File; # Your additional stuff here 1;

In your main file

use File; # Your stuff here

Update: Removed unneeded package declaration as per Tanktalus's excellent notes.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^2: 1 Object 2 Files
by Tanktalus (Canon) on Jan 11, 2005 at 20:52 UTC

    You don't really actually need the package File::Additional; line in File/Additional.pm. Perl enforces no requirements that the file name matches the package name - it's just a good convention.

      Actually, you do if you want use File::Additional; to work. Perl does enforce that if you say use Foo::Bar::Baz; that there actually exists a Foo/Bar/Baz.pm somewhere in your @INC and that it has, somewhere, a line saying package Foo::Bar::Baz;. Otherwise, it will bitch at you.

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

        That has not been my experience:

        $ cat Foo.pm package Bar; 1; $ perl -e 'use Foo;' $ perl -v This is perl, v5.8.5 built for i686-linux Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge.