Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

symbolic links to the rescue!

On your development machine, install your custom perl in /usr/local, then make /usr/bin/perl a symbolic link to /usr/local/bin/perl like this:

ln -s /usr/local/bin/perl /usr/bin/perl

Then you can use the same shebang on both development and production servers.

For modules, install everything into a local 'lib' directory, then use the line:

use lib '/path-to-lib/lib';

In all your scripts. Copy the lib directory to the production server, so that the scripts there will have access to the same libraries.

For anything else, try to use config files. For example, say you want "debug mode" to be active on the development server, and not active on the production server.

First create two files: dev-config.ini will contain the line:

DEBUG = 1

prod-config.ini will contain the line:

DEBUG = 0

Now create more symbolic links:

On the development server:

ln -s dev-config.ini config.ini

On the production server:

ln -s prod-config.ini config.ini

So your scripts only need to read "config.ini", but it's one thing on the dev side and another on the prod side. Once you read the config file, you can do things like this in your script:

if ($DEBUG) { # do debug stuff } else { # whatever }

The idea is to make each server look as much the same as possible, so that you can just tar/zip the entire app directory on the development server, ftp it to the production server, and then unzip/tar it and everything work. With a little effort up front, it's definitely possible, and it makes life much easier.


In reply to Re: Dev Hashbang by scorpio17
in thread Dev Hashbang by Xiong

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 cooling their heels in the Monastery: (5)
    As of 2014-09-19 05:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (129 votes), past polls