Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )

by craigt (Acolyte)
on Nov 04, 2014 at 04:05 UTC ( [id://1105967]=note: print w/replies, xml ) Need Help??


in reply to Re: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )
in thread comparing 2 file time date stamps

Thank you anonymous_monk. Its been a real pleasure to browse through the archives of this place and be able to ask questions of knowledgeable people. I really like this language. I'll work with your suggestion and get back.

Replies are listed 'Best First'.
Re^3: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )
by craigt (Acolyte) on Nov 04, 2014 at 13:00 UTC

    anonymous_monk, I could not get that code to work. The Time-Piece was not available in the repositories PPM checked. I tried with File-Stat and got several PM dependency messages.

    I apologize for not using these facilities as I should sometimes. My lack of experience is showing.

    I tried reversing the file order in the diagnostics. The stat 9 values for both tests were still the values of the file not in the staging directory, in this case now the 2nd file in the diagnostic order. I don't seem to be able to see the file in the staging area.

        I get the following error when I try to execute that subroutine

        path" is not exported by the Path::Tiny module\nCan't continue after import

        I use -

        use File::stat;
        use Path::Tiny qw/ path /;
        use File::Spec;
      I tried
      use File::stat; use Time::localtime; $dd[11] = ctime(stat("$xxfn1")->mtime); $dd[12] = ctime(stat("$xxfn2")->mtime);
      The result was for both files

      Mon Nov 3 11:57:55 2014

      which is the stamp of the file not in the staging directory.

      All methods seem to return the same modification date for both files, even though the file dates are 11/3 and 11/2, respectively.

        I tried ... stuff I did not recommend

        Sorry dude :) Time::Piece is the core module with the neato API that stop you from having to do + 1900 nonsense ...

        $ perl -e " use Time::Piece; print localtime->year,$/ " 2014
      I tried
      use File::stat; use Time::localtime; $dd[11] = ctime(stat("$xxfn1")->mtime); $dd[12] = ctime(stat("$xxfn2")->mtime);
      The result for both files was

      Mon Nov 3 11:57:55 2014

      which is the stamp of the file not in the staging directory.

      All methods seem to return the same modification date for both files, even though the file dates are 11/3 and 11/2, respectively.

        I don't think you want or need the quotes around the file variables. These modules work, they must be being applied to files other than the ones you intend. What is the output if you add the following immediately before you use the ctime function?

        printf "File 1:%s File 2: %s\n", $xxfn1, $xxfn2;
        1 Peter 4:10
      The correct files names are printed.
      I'm working on an application on a Windows 7, Apache/2.0.64 (Win32), mod_perl/2.0.3, and Perl/v5.8.3 platform. This version of Perl has been rock solid, so I have not upgraded. If I do need to upgrade Perl, what version should I go to. I've written about 110K lines and the application is up under mod_perl without error. This is a very important function I use in several ways in several places.
      Also, stat seems to get hosed in memory and no longer returns any file information. I have to reboot to get stat to work again.
      I just looked at the date of the file in the staging area in javascript with the same result. stat 9 is not being used in this pass. The file in the staging area keeps showing a Nov 3 date and the external date is Nov 2.

      anonymous_monk, I don't see any way to respond as you requested. I'm sure its me. I only see an option to reply on the entry I've been using and those above on the page.

        Did you try removing the quotes around the file name variable? Run the following, verbatim, and post the results, verbatim. Where I have the ???, fill in the path and name of one of your files.

        use strict; use warnings; use File::stat; use Time::localtime; my $file = ???; printf "%s: %s\n", $file, ctime(stat($file)->mtime);
        1 Peter 4:10

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1105967]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found