Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
and make these programs aware of their immediate surrounding structures regardless of where in the directory tree the folder 'project' is placed ?.

"regardless" is a rather strong word; if your scripts should really find their project directory on their own, without any helping assumptions or config files, they'd have to recursively search all directories -- in general that's a very bad idea.

I know several approaches that some programs out there in the wild take (and often they take several of those in combination), listed in no particular order:

  • Assume that the current working directory is the project dir
  • Search the current directory and all of its parents for special files/directories. For example git, the distributed version control system, does that for finding repositories
  • Search in hard-coded places
  • Search for config files in hard-coded places, and read them to determine where to go
  • Search in directories relative to your home directory
  • Search relatively to the installation path of the binary
  • Use environment variables and/or command line options to find project dirs.

In the end, it all depends on what you want, and on the usualy work flow. Maybe you like some of the options I've listed.


In reply to Re: Directory independent processing by moritz
in thread Directory independent processing by biohisham

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (11)
    As of 2014-08-20 13:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (114 votes), past polls