in reply to Re^3: Where does time come from? CORE::GLOBAL:time no honored.
in thread Where does time come from? CORE::GLOBAL:time no honored.

The program I am running is large and I have not been able to reproduce the problem in a small example. You're right, I forgot to mention that the value returned by time() in the program code is not the value returned by my function, but calling time() in the debugger does return the value from my function. Witness:
500: my $time = time(); DB<4> n Queue::MySQLQ::dequeue(/Users/foo/lib/Queue/MySQLQ.pm:501): 501: my $expire_time = $time + $WORKER_HEARTBEAT_FAILURE; DB<4> x $time 0 1238124047 DB<5> x time() 0 1238124062 DB<6> sleep 2 DB<7> x time() 0 1238124062
What situation could cause time() in the program code to run different code than time() called in the debugger?

Thanks for all the help.

Replies are listed 'Best First'.
Re^5: Where does time come from? CORE::GLOBAL:time no honored.
by ikegami (Patriarch) on Mar 27, 2009 at 04:14 UTC
    My first thought was that time in my $time = time(); might not be CORE::time(). But it doesn't seem to matter.
    use strict; use warnings; BEGIN { no warnings qw(redefine); *CORE::GLOBAL::time = sub { 4 }; } use subs qw( time ); sub time { 5 } my $time = time(); 1;
    main::(a.pl:12): my $time = time(); DB<1> n main::(a.pl:14): 1; DB<1> x $time 0 5 DB<2> x time() 0 5

    Sorry, no idea.