in reply to children without inheritance

OK I'll try to be more succinct. Imagine I have 300 projects whose classes all live in $HOME/lib. A project has two new classes A and B which are symbiotic but without any inheritance between them. Tomorrow I may have a project with ten classes like that or that may have inheritance, it doesn't matter. I want to know the most usual way (preferably CPAN-like) to locate the .pms for a given project and therefore given that syntactically to use the packages and call the methods. I ask that so I can see if the suggestion is conformant with CPAN or not. Thanks!

One world, one people

Replies are listed 'Best First'.
Re^2: children without inheritance
by tod222 (Pilgrim) on Nov 19, 2010 at 19:41 UTC

    The point people are trying to make is that the file naming specifies nothing about the relationship between the classes.

    These file layouts are all valid:

    A.pm B.pm A.pm A/B.pm B.pm B/A.pm AB/A.pm AB/B.pm Foo/A.pm Foo/Bar/B.pm

    It's what's inside the files that determines inheritance, not the names of the files themselves.

    Include the following before you use any of your private modules:

    BEGIN { push(@INC, $ENV{'HOME'} . '/lib'); }

    So, for example:

    #!/usr/bin/perl use strict; use warnings; BEGIN { push(@INC, $ENV{'HOME'} . '/lib'); } use Foo::A; use Foo::Bar::B; my $a = Foo::A->new(); my $b = Foo::Bar::B->new();
Re^2: children without inheritance
by roboticus (Chancellor) on Nov 19, 2010 at 18:23 UTC

    Succint wasn't requested--rather the opposite: More detail would be helpful.

    ...roboticus