in reply to Re: Directory Structure
in thread Directory Structure

And end up with programs that only work from B, and its sibling directories?

Replies are listed 'Best First'.
Re^3: Directory Structure
by zentara (Cardinal) on Aug 27, 2011 at 21:12 UTC
    And end up with programs that only work from B, and its sibling directories?

    From my reading of the OP's original post, he wanted a relative program and module structure. This works for an A sub dir holding the program Foo-use, and a parallel level module dir B, holding a module Foo1.pm. The relative nature of the directories means they can be installed anywhere together, and the module in B will be found.

    Make 2 subdirs anywhere in an arbitrary directory, named A and B

    In A, the program:

    #!/usr/bin/perl use lib "../B"; use Foo1 foo; use Tk; # put in to show that @inc is still working fine foo(); print "Goodbye\n";

    In the parallel B module directory, the module Foo1.pm

    #module Foo1.pm located in B package Foo1; require Exporter; @ISA = qw|Exporter|; @EXPORT_OK = qw|foo|; sub foo { print "Hello World, I'm here\n"; } 1;

    Run it:

    $ ./A/Foo-use Hello World Goodbye

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh