SPUG: to change the directory

Sachin Chaturvedi sachin_chat at coolgoose.com
Wed Dec 29 23:27:35 CST 2004


i am running a script say scrt1.pl , which calls modules mod1.pm which in turn calls mod2.pm.
in mod2.pm i make a directory change depending upon some condition like type of platform etc.
then in mod1.pm i change the directory to original directory which was initially the current working directory.

code is like

IN MOD2.PM

if ($platform == "linux") && ($KERNEL_DEBUG == 1))
{
mkdir("linux_debug",0777);
chdir("$cwd/linux_debug");
}
else
{
mkdir("linux_nondebug",0777)
chdir("$cwd/linux_nondebug");
}
 
here depending upon some parameter i make dir and change to it.

NOW IN MOD1.PM

$direc = cwd();

i call mod2.pm from here .
then i change to 4direc again.

but the problem i am facing is even i do this , it is not changing the directory to initial directory. if i change to linux_debug 
it stays there for ever. if i run script with $KERNEL_DEBUG = 0, it remaions from starting of script in linux_debug where it was 
in earlier time when i ran the script.

how can i get rid of this ???

thanks
sachin


More information about the spug-list mailing list