| |||
Calling external programs Posted by smithce (smithce), 12 June 2006 Hi GrahamI have a number of perl scripts that call a configuration management package which in turn interogates it's own proprietary database. This is fine except that now we are running tow versions of the external program and I need someway to interogate the path setting and substitute the for one version or the other. Obviously, I can return the PATH variable from the %ENV hash but am a bit stumped on how I can strip out one setting and substitute the other depending upon which version I require. The two executable path's are: C:\Telelogic\SYNERGY CM 6.4\bin and F:\CMSYNERGY\BIN Yes...the old version is a network install, the new one is a local install. I realise this is a bit of a numpty question but it is Monday morning after all !! Posted by admin (Graham Ellis), 12 June 2006 Silly question (because it's Monday evening ![]() Why not simply have your Perl script run the new version by giving the full path to it, and not bothering with the environment variable at all? Or have I missed something? Posted by smithce (smithce), 13 June 2006 Exactly....I did try that but because the second executable path has spaces in it it did not seem to work.One of the things that I have struggled with since picking up Perl is quoting, backticks etc etc. CM Synergy (The application) has a query line e.g. open(CCM ,`C:\\Telelogic\\SYNERGY CM 6.4\\bin\\ccm` . "start -d $db_path -h $db_host -m -pw $db_passwd -n $db_user -r $role -q -nogui| ") || die "ERR_004 : ccm start $db_path failed \n" ; Because the later version of CM synergy has been installed to a path with spaces I tried the above using the join command to join the command line together. However, now it complains about the -d option. Now, in my guestimation it's either not translating the command line properly or it's picking up the wrong version of the executable ? Posted by admin (Graham Ellis), 13 June 2006 I think your Perl script can probably run something with spaces in the path name using something like ....$result = `"C:\\Telelogic\\SYNERGY CM 6.4\\bin\\ccm" start -d etc etc` The vital things are the double quotes to pass in the full path and program hame to the windows shell ... Posted by smithce (smithce), 13 June 2006 Yes...with your help and reading through the perlop I see what I was doing wrong !!Many thanks Clive This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
| |||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |