i have a bug in my program and i cannot figure out. since the procedure is quite complex i'm gonna try to summarize it within the following example. i know this is not the popper way to do it but i'm gonna start here and then give additional examples if needed. so what i have is a perl shell through which i'm sending commands to my os. the shell was written by me and it uses Term::ReadLine and Term::ReadKey for acquiring the input. after it gets an input, it sends it to evaluation using the eval()function. the evaluation here stands for discriminating which functions are allowed in my psh and which are not.example: i do not allow variables under no strict; pragma, then i do not allow calling next unless('something') && print 'something'; and so on....
where is the problem? once i call a function that takes as input a path to the file which is in a different folder, like:
what happens, the path variable is send to an object in a library that takes it as :run(open => './path/to/', do=> 'tell what to do', save => './path1/to' +);
and then in the next sub the procedure gets finished like:sub run{ my ($self,%arg) = @_; if (defined $arg{open}){ $self->_open_it_and_run_it(open => $arg{open}); } }
so what happens is that i doesn't matter how many sub processes like this i have, if i set the path for opening to be :sub _open_it_and_run_it{ my ($self,%arg) = @_; open (IN, "<",$arg{open}) || die "$!"; while (<IN>){ ... } close IN: }
everything is fine but if i set it to be :run(open =>'./', ....);
once the dir gets opened the whole contents of that dir , gets erased, where in the first case this is not so.run(open =>'./dir/', ....);
so my question is, does any one has a clue what is going on here, is it a bug in perl or ... because i tried the various combinations and non showed this behavior but this one.
Please state what input do you need to get a clear view. i cannot present the whole code at this time, sorry.(this is not commercial software)
thnx
UPDATE
ok, ppl.
i know i pushed you through some trouble and i am GRATEFULL for all your help. i figured it out but only due to your comments.
there is a problem with my OS. I am running a CentOS 4.7 64 - no updates(i have to!) and for some reason when i run the script as described, when the file is being red it creates a .file.txt for no reason(or just changes the name)and then the file becomes invisible. i have tested the program on the debian and it works like a charm.
So i'm relay sorry for doubting in perl, I know that,as Corion said "suspecting a bug in Perl is a bad approach" but i was desperate.
so once more thank you!!!!!
In reply to [SOLVED]open to read file, erases all my files by baxy77bax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |