CRISIL
asked on
Passing arguments / setting environment variables for a perl script
HI,
I am new to perl script and need to run a perl script found at the following URL http://ximbiot.com/cvs/cvshome/cyclic/cvs-html/dev-pvcs_to_rcs.pl
Please tell me how to set the environment variables / passing arguments to this script file.
I have already installed Active Perl 5.8.8 Build 817 on Windows.
Looking for some early response from PERL evangelists
Thanks in advance
Vaneet
I am new to perl script and need to run a perl script found at the following URL http://ximbiot.com/cvs/cvshome/cyclic/cvs-html/dev-pvcs_to_rcs.pl
Please tell me how to set the environment variables / passing arguments to this script file.
I have already installed Active Perl 5.8.8 Build 817 on Windows.
Looking for some early response from PERL evangelists
Thanks in advance
Vaneet
ASKER
Hi,
Thanks for responding so quickly.
When i am tring to run this file using the command
perl dev-pvcs_to_rcs.pl
It is giving me the following error-
----------------ERROR----- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -------
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
The following executables were not found in your PATH: vcs vlog rcs ci
You must correct this before continuing.
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -------
Not able to understand it .
Please guide me
Thanx & Regards
Vaneet
Thanks for responding so quickly.
When i am tring to run this file using the command
perl dev-pvcs_to_rcs.pl
It is giving me the following error-
----------------ERROR-----
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.
The following executables were not found in your PATH: vcs vlog rcs ci
You must correct this before continuing.
--------------------------
Not able to understand it .
Please guide me
Thanx & Regards
Vaneet
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Subhas,
Actually , i am new to perl script , so dont understand the perl code properly.
I will give u an idea what this script does .
Basically i want to migrate some code from one source control system to another source control sytem i.e i want to migrate the repository from PVCS to RCS system .
So , i think this script will take some inputs like
1) location of the PVCS repository
2) New location where the code wiill be migarted i.e RCS repository
This is what i am able to understand from this script file.
I hope probably , you can guide me more on this
Really looking forward to your assistance.
Thanks & Regards
Vaneet
Actually , i am new to perl script , so dont understand the perl code properly.
I will give u an idea what this script does .
Basically i want to migrate some code from one source control system to another source control sytem i.e i want to migrate the repository from PVCS to RCS system .
So , i think this script will take some inputs like
1) location of the PVCS repository
2) New location where the code wiill be migarted i.e RCS repository
This is what i am able to understand from this script file.
I hope probably , you can guide me more on this
Really looking forward to your assistance.
Thanks & Regards
Vaneet
Have you included the environment variable for vcs vlog rcs ci ?
ASKER
No,
How to do that ?
How to do that ?
You should set these environment variables (with SETENV for the C shell or EXPORT for the SH or KSH shells)
ASKER
what is the synatx of setting environment variables ?
Can i, do this from command prompt in WIndows.
Can i, do this from command prompt in WIndows.
ASKER
Hi Subhas,
I have few doubts on the following lines in the script
-------------------------- ---------- ---------- ---------- ---------- ---------- ----------
# The binaries this script is dependant on:
my @bin_dependancies = ("vcs", "vlog", "rcs", "ci");
# Where we should put temporary files
my $tmpdir = $ENV{TMPDIR} ? $ENV{TMPDIR} : "/var/tmp";
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---
Kindly tell, how can i set the dependencies on the first line.
and how do i set the location of temporary directory in the script.
Can i hard code it ?
And how do i set through command line .....
Thanx & Regards
Vaneet
I have few doubts on the following lines in the script
--------------------------
# The binaries this script is dependant on:
my @bin_dependancies = ("vcs", "vlog", "rcs", "ci");
# Where we should put temporary files
my $tmpdir = $ENV{TMPDIR} ? $ENV{TMPDIR} : "/var/tmp";
--------------------------
Kindly tell, how can i set the dependencies on the first line.
and how do i set the location of temporary directory in the script.
Can i hard code it ?
And how do i set through command line .....
Thanx & Regards
Vaneet
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Tal,
When i tried running your command setenv TMPDIR kuku; dev-pvcs_to_rcs.pl
It gave the following error on the command promompt
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------
C:\>setenv TMPDIR kuku; dev-pvcs_to_rcs.pl
'setenv' is not recognized as an internal or external command,
operable program or batch file.
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- --
Also talking about the path name for the temp directory , does that path name should be relative or absolute.
How can i pass all the dependencies mentioned at the following line
-------------------------- ---------- ---------- ---------- ---------- ---------- ------
# The binaries this script is dependant on:
my @bin_dependancies = ("vcs", "vlog", "rcs", "ci");
-------------------------- ---------- ---------- ---------- ---------- ---------- -------
Thanks & Regards
Vaneet
When i tried running your command setenv TMPDIR kuku; dev-pvcs_to_rcs.pl
It gave the following error on the command promompt
--------------------------
C:\>setenv TMPDIR kuku; dev-pvcs_to_rcs.pl
'setenv' is not recognized as an internal or external command,
operable program or batch file.
--------------------------
Also talking about the path name for the temp directory , does that path name should be relative or absolute.
How can i pass all the dependencies mentioned at the following line
--------------------------
# The binaries this script is dependant on:
my @bin_dependancies = ("vcs", "vlog", "rcs", "ci");
--------------------------
Thanks & Regards
Vaneet
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I was just looking at the code, and there are commands in there that will NOT work under windows.
Specifically the hit_any_key function. It uses the stty program to read a single character from the keyboard.
You can change it like so:
sub hit_any_key
{
print "Press Return or Enter to continue...";
my $garbage=<STDIN>;
}
Specifically the hit_any_key function. It uses the stty program to read a single character from the keyboard.
You can change it like so:
sub hit_any_key
{
print "Press Return or Enter to continue...";
my $garbage=<STDIN>;
}
Sorry for multiple posts.....
I also just noticed the method it uses to look for the binaries uses the "which" program, which does not exist on windows. If you are sure you have the binaries installed, you can remove that logic.
I also just noticed the method it uses to look for the binaries uses the "which" program, which does not exist on windows. If you are sure you have the binaries installed, you can remove that logic.
ASKER
Hi Adam,
Thanx a ton for looking at my script.
Adam i will be setting the path variable for vcs vlog rcs ci scripts.
I have few queries regarding my script
1)How can i set the path of my PVCS repository
2) How can i set the path of my destination repository (RCS repository)
3) Can i run this script on some unix emulator on my WIndows machine ? If yes please suggest some emulator for windows.
4) Please elaborate more on "which" program
Thanx & Regards
Vaneet
Thanx a ton for looking at my script.
Adam i will be setting the path variable for vcs vlog rcs ci scripts.
I have few queries regarding my script
1)How can i set the path of my PVCS repository
2) How can i set the path of my destination repository (RCS repository)
3) Can i run this script on some unix emulator on my WIndows machine ? If yes please suggest some emulator for windows.
4) Please elaborate more on "which" program
Thanx & Regards
Vaneet
4) The "which" program is a program common on unix systems that will tell you the location of another program.
So if you typed "which ls" (ls is similiar to "dir" in windows), it would come back with "/usr/bin/ls"
If windows had which, and you typed "which excel.exe", it would come back with "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
The script is using the which program to determine if and where the binaries vcs vlog rcs and ci are located.
3) The script says it was tested on solaris. You could try running it on cygwin:
http://www.cygwin.com/
I'm not sure if the binaries, vcs vlog rcs ci, would work as expected though. I think you'd have to try it to find out.
A few minor changes to the script and you should be able to run it on windows though.
1 and 2) It looks like you should be in the PVCS directory, and it will put the files in an RCS directory one level up.
Eg:
C:\Repositories\VCS This is the PVCS directory, run script from this directory
C:\Repositores\RCS This is where the new files will go
So if you typed "which ls" (ls is similiar to "dir" in windows), it would come back with "/usr/bin/ls"
If windows had which, and you typed "which excel.exe", it would come back with "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
The script is using the which program to determine if and where the binaries vcs vlog rcs and ci are located.
3) The script says it was tested on solaris. You could try running it on cygwin:
http://www.cygwin.com/
I'm not sure if the binaries, vcs vlog rcs ci, would work as expected though. I think you'd have to try it to find out.
A few minor changes to the script and you should be able to run it on windows though.
1 and 2) It looks like you should be in the PVCS directory, and it will put the files in an RCS directory one level up.
Eg:
C:\Repositories\VCS This is the PVCS directory, run script from this directory
C:\Repositores\RCS This is where the new files will go
I think using the "set" command only sets the environmental variable temporarily -- when you close the DOS command line box, the variables you added cease to exist. If you'd like to set the variables permanently, right-click on My Computer, and select the properties menu option. On the System Properties dialog that appears, click on the Advanced tab. Click on the button labeled Environment Variables, and you can see all the current (pre-defined) variables in your environment. Using the New button in the System variables pane of the Environmental Variables dialog box, you can add new variables to your environment that will presist. These instructions are for XP; your mileage may vary with other Windows versions.
Another option for running *NIX scripts and applications on Windows is virtualization. At work, I run Fedora 7 (and several other OSes and apps) as a virtual appliance (see http://www.vmware.com/vmtn/appliances/directory/) under Windows XP using the free VMWare Player (see http://www.vmware.com/products/player/).
Another option for running *NIX scripts and applications on Windows is virtualization. At work, I run Fedora 7 (and several other OSes and apps) as a virtual appliance (see http://www.vmware.com/vmtn/appliances/directory/) under Windows XP using the free VMWare Player (see http://www.vmware.com/products/player/).
ASKER
Hi,
I installed the unix emulator cygwin and tried running the script.
Although i have set the environment variable 'path' correctly, but still it is not able to find the rcs and ci scripts.
When i try to print the environmnet variable path in cygwin ,using the following script
------------------------
print $ENV{'PATH'};
-------------------------
Its not showing the location for rcs and ci scripts.
Please tell me what can be wrong.
I installed the unix emulator cygwin and tried running the script.
Although i have set the environment variable 'path' correctly, but still it is not able to find the rcs and ci scripts.
When i try to print the environmnet variable path in cygwin ,using the following script
------------------------
print $ENV{'PATH'};
-------------------------
Its not showing the location for rcs and ci scripts.
Please tell me what can be wrong.
ASKER
Hi Adam,
If i am running this script in cygwin , do i need to make any changes in the script.
If yes, please tell me what i need to change in this script.
Thanks & Regards
Vaneet Sharma
If i am running this script in cygwin , do i need to make any changes in the script.
If yes, please tell me what i need to change in this script.
Thanks & Regards
Vaneet Sharma
In cygwin, you're working in a Unix environment again. The path file in cygwin is in something like c:\cygwin\etc\profile. You can edit this file with a text editor, and add whatever directories you need to to your cygwin path, separated by full colons (:), e.g.:
PATH="/usr/local/bin:/usr/ bin:/bin:/ usr/X11R6/ bin:.:$PAT H
PATH="/usr/local/bin:/usr/
I'm not familiar with with script or the VCS or RCS version control systems, so I can't say for sure. The problems with the script I pointed out were obviously not going to work on windows. I don't see anything that should prevent it from working though.
You'll have to update your path as mjcoyne said so that all of the binaries are found. If you run the script, and it doesn't find all of them, it will give you a warning message.
If you seem to have the path to the binaries correct, and the script still doesn't find them, you might need to make a copy of <name>.exe to just <name>. Unix doesn't use an .exe extension for executable files. I'm not sure if cygwin will take care of that automatically or not.
So, for example, if you have "vcs.exe", make a copy called "vcs" in the same directory.
You'll have to update your path as mjcoyne said so that all of the binaries are found. If you run the script, and it doesn't find all of them, it will give you a warning message.
If you seem to have the path to the binaries correct, and the script still doesn't find them, you might need to make a copy of <name>.exe to just <name>. Unix doesn't use an .exe extension for executable files. I'm not sure if cygwin will take care of that automatically or not.
So, for example, if you have "vcs.exe", make a copy called "vcs" in the same directory.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$path = $ENV{'PATH'};
example:
#!/usr/bin/perl
$ENV{'PATH'} = '/bin:/usr/bin:/home/fred/
print $ENV{'PATH'};
To get the command line arguments inside script:
@ARGV
i.e., $ARGV[0] filename
$ARGV[1] first argument
$ARGV[2] second argument etc...
to run a file:
>perl filename