Hi Bayruds,

First, a quick note about formatting your posts: put "<code>" and "</code>" at the beginning and end of perl code -- not including paragraphs of text (use plain old html tags like <P>, <UL>, etc to format your text). It's easy to get to Writeup Formatting Tips -- take a look at that.

Second, how about you try one more diagnostic: create a junk file (or locate such a file that already exists), and give the path/name of that file as a command line arg to this little script:

#!/usr/bin/perl print "-M of $ARGV[0] is ".(-M $ARGV[0]).$/; # should be positive system("touch $ARGV[0]"); # reset file's mod time to now. sleep 1 print "-M of $ARGV[0] is now ".(-M $ARGV[0]).$/; # should be (very sma +ll) negative sleep 4; print "-M of $ARGV[0] is now ".(-M $ARGV[0]).$/; # should be equal to +previous
If the outputs disagree with the comments, you might have a deep problem -- you may need to report which OS you're using, and which perl version. (Maybe even what sort of hardware you have.)

You seem to be doing the right sort of test (-M>0), so it could still be one of those cases where you really believe that you're checking the right file (the same one that the 3rd party thing created), and that the file is new, etc, when in fact...

update: fixed link


In reply to Re: -M file test operator by graff
in thread -M file test operator by bayruds

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.