Hi,

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:

run(open => './path/to/', do=> 'tell what to do', save => './path1/to' +);
what happens, the path variable is send to an object in a library that takes it as :
sub run{ my ($self,%arg) = @_; if (defined $arg{open}){ $self->_open_it_and_run_it(open => $arg{open}); } }
and then in the next sub the procedure gets finished like:
sub _open_it_and_run_it{ my ($self,%arg) = @_; open (IN, "<",$arg{open}) || die "$!"; while (<IN>){ ... } close IN: }
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 :
run(open =>'./', ....);
everything is fine but if i set it to be :
run(open =>'./dir/', ....);
once the dir gets opened the whole contents of that dir , gets erased, where in the first case this is not so.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.