Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Environmental Variables

by Mounty (Initiate)
on Nov 23, 2006 at 09:23 UTC ( [id://585692]=perlquestion: print w/replies, xml ) Need Help??

Mounty has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Environmental Variables
by Corion (Patriarch) on Nov 23, 2006 at 09:39 UTC

    Then you need to set up the proper environment from within your .bat file, or have a multilevel setup that first sets up the environment and then calls your Perl script. If you are on Windows 2000 or XP, the cmd.exe shell has the facilities to help you there. Suppose you have a .cmd file that sets up your environment, then you can either hardcode the path to in your commit hook or put that environment file into a fixed directory relative to your commit hook and then call it as necessary:

    @echo off CALL C:\hardcoded\path\to\env_setup.cmd CALL C:\hardcoded\path\to\your\commit_hook.cmd @rem or even perl -w c:\hardcoded\path\to\your\commit_hook.pl @rem assuming that env_setup.cmd sets up $ENV{PATH} to include Perl.ex +e

    If your env_setup.cmd, commit_hook.cmd and perl.exe all live in directories that can be navigated relatively, I recommend the following approach:

    @echo off @rem Change into the directory where this file resides cd /d "%~dp0" call setup_env.cmd perl -w your\commit_hook.pl
      Thanks for that, I ended up with an even simpler soloution. I just added a:

      SET PATH="...."

      As the first line of the .bat. As the file isn't going anywhere any time soon i think it should be ok.

      Luckly there are a set number (5) of hooks that can be implemented, so thay all now have .bat files pointing at Perl scripts.

      Thanks again for your help

      M

Re: Environmental Variables
by Tomte (Priest) on Nov 23, 2006 at 09:37 UTC

    Please take the time to read a little bit on "How (Not) to ask a question" - just Super Search the phrase...

    ... then post code, real error messages and more information on where this is supposed to work (OS, perl-version, ...)

    regards,
    tomte


    An intellectual is someone whose mind watches itself.
    -- Albert Camus

Re: Environmental Variables
by inman (Curate) on Nov 23, 2006 at 09:56 UTC
    Environmental Variables

    Presumably these are like normal variables but they plant trees and don't contribute to global warming ...

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://585692]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-25 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found