in reply to Re^3: grep confusion
in thread grep confusion

PriNet:

You could use stat to get the file modification time, and then sit in a loop waiting for the file modification time to change:

$ cat pm_1198604.pl use strict; use warnings; system("touch FName.dat"); my $ctime = (stat 'FName.dat')[10]; # Proxy for your spreadsheet update... system("(sleep 10; date; touch FName.dat) &"); my $timeout = time + 60; # Don't wait forever! while (1) { # File changed yet? my $new_ctime = (stat 'FName.dat')[10]; last if $new_ctime > $ctime; die "TIMEOUT!" if time > $timeout; print "still unchanged, waiting a little while\n"; sleep 2; } print ".. continuing to next chunk of work\n"; $ perl pm_1198604.pl still unchanged, waiting a little while still unchanged, waiting a little while still unchanged, waiting a little while still unchanged, waiting a little while still unchanged, waiting a little while still unchanged, waiting a little while Sun, Sep 3, 2017 11:35:11 AM .. continuing to next chunk of work

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^5: grep confusion
by PriNet (Monk) on Sep 03, 2017 at 19:37 UTC
    'Apparently', Spreadsheet::ParseExcel::SaveParser has issues 'editing' existing XLS files:

    "An Excel file is a binary file within a binary file. It contains several interlinked checksums and changing even one byte can cause it to become corrupted"
    -https://groups.google.com/forum/#!topic/spreadsheet-writeexcel/FeEx0vXQErQ

    I believe I am going to have to 'rewrite' the 'optional changes after creation' section of my program to read in the existing XLS with Spreadsheet::ParseExcel then 'recreate' a new copy of the XLS with Spreadsheet::WriteExcel and then overwrite the previous XLS with this new 'modified' copy. I'll post my results when I get this rewritten...(I did notice that 'irronius' errors appear more-so when I tried modifying a cell)

    Has anyone seen this sliced bread thing? I's better than... sliced... well... never mind...
      Final Notes:
      (for anyone following)
      There WAS an issue using the Spreadsheet::ParseExcell module, it really does not like modifying the XLS file then trying to read it back immediately. I ended up re-writing (with some difficulty, not alot of precise info on it) using the Spreadsheet::Read module, which seems (so far), to work just ducky. I appreciate all the time and effort everyone gave with help on my project, I believe I'm to the point of using Use Tk to actually start my script doing something. I ended up not using the grep function as of yet, I may refer to the help provided when I get to the actual GUI part... Thanx a gigabyte to everyone that followed up on my issues (btw; I still get the subscript -1 issue arbitrarily, I will investigate that next).
      In the words of the Swartz... "I'll be back"
      Thanx again, I'll email twinkies out tomorrow.

      Has anyone seen this sliced bread thing? I's better than... sliced... well... never mind...
Re^5: grep confusion
by PriNet (Monk) on Sep 03, 2017 at 17:07 UTC
    excellent idea, let me try implementing that concept and see if 'timing' is really the issue... yuppers, that's a good idea...

    I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...