[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] timelocal.pl help needed



Ken Tanaka <tanaka9@idt.net> writes:
}Hi,
}I'm somewhat new to MacPerl, but I've written some Perl on UNIX.
}I was starting to write a script to find files more recent than a
}certain date (for backup purposes) in my file system but ran into
}some problems using timelocal.pl.

You should be using Time::Local now.  If you had upgraded to 5.14r4, you
actually would be, since now timelocal.pl is now simply a front end for
Time::Local.

}
}The following script is a boiled-down version of my problem.  It
}prints the first "print" but never gets to the second print.
}(Actually I gave it as long as 9 minutes before I gave up and
}interrupted it with command-period)
}----- start of code
}#!/usr/local/bin/perl -w
}##***********************************************************************
}##
}##	File:  a_timelocal.pl
}##
}##***********************************************************************
}require "timelocal.pl";
}
}
}print "---- New Run:  a_timelocal.pl ----\n";
}($sec, $min, $hours) = (1, 2, 3);
}($mday, $mon, $year) = (28, 10, 1996);
}$comptime = timelocal($sec,$min,$hours,$mday,$mon,$year);
}print "comparison time=$comptime\n";
}----- end of code
}
}Does anyone see any mistakes I'm making?

Here's what I get under 5.14r4:

---- New Run:  a_timelocal.pl ----
comparison time=2931994921

The problem is probably the old integer bugs in Perl 5.002, where unsigned
ints > 2^31 were treated as signed ints.  I haven't looked at the old
timelocal.pl in quite a while, but I believe there was a place where it
could infinite loop (or at least count down to -2^31 in small increments,
which amounts to the same thing).

Upgrade.  Your problem will disappear.

}
}I'm running the MacPerl Application 5.1.3r2 + MacPerl Big with 6000KB
}allocated to it.
}About This Macintosh: System Software is 7.1P2, Macintosh Performa 600 CD
}(68030, 32MHz, no FPU), 12MB Physical RAM.
}
}Thanks for any help.  Better yet, if someone has already written a script
}to gather files for backup, let me know.
}
}-Ken Tanaka
}tanaka9@mail.idt.net
}
}-:-------------------------------------:-
}o: Ken Tanaka                          :o
} : email:  tanaka@hrlban1.alhra.af.mil :
}o: phone:  (602) 988-9773 ext 413      :o
} : Armstrong Labs / Boeing             :
}o:                                     :o
}-:-------------------------------------:-
}
}
}
}***** Want to unsubscribe from this list?
}***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch