in reply to automatic web query and writing files in a directory

my $basepath = "c:\\foo\\bar"; my $dir = $basepath."\\".$gene."_".$geneid; mkdir($dir, 0755) or die "Failed creating $dir\n"; chdir($dir); #what file are you writing? That is so ambiguous. Let us pretend $st +ring is your file contents and I will make up a filename becuase you +weren't specific about that either. my $file = "baz.txt"; open(OUT, ">>$file") or die "Cannot open $file for writing\n"; print OUT $string; close(OUT);

Replies are listed 'Best First'.
Re^2: automatic web query and writing files in a directory
by Anonymous Monk on Jun 07, 2007 at 21:21 UTC
    Thanks Grundle, Actually i want it to make automatic, the code should fetch the data from the website and write the file, check wheather the file is written in the specied folder then pause for a moment and then start to fetch another file and repeat the process.... If its possible then I will send u the whole code and file for which I want to automate the process....

      There's always the drastic step of reading the docs for something like WWW::Mechanize, HTML::TableContentParser, sleep or somesuch yourself, rather than relying on Grundle to do your coding for you... Plus you'll be in a much better position to help yourself later on if something ever happens to Grundle (heaven forbid)...

      HTH,

      planetscape
        I agree with you planetscape. I cannot, nor would I want to, write your code for you. All I tried to do is give insight into the process.

        Honestly if you cannot automate your process based on what we have given you, this may not be the profession for you. This something so utterly easy that is confounds me how it cannot be implemented now.

        You have two tasks -- retrieve the information from the web. You have been given the modules that enable you do do that. Now go read the documentation. The second is writing the files, which I showed you how to do. Good luck!