forked from libwww-perl/HTTP-Message
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a possible hack to workaround libwww-perl#101
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package FakeTime; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
require Exporter; | ||
our @ISA = 'Exporter'; | ||
our @EXPORT_OK = 'time'; | ||
|
||
sub import { | ||
my $pkg = shift; | ||
return unless @_; | ||
my $sym = shift; | ||
my $where = 'CORE::GLOBAL'; | ||
$pkg->export($where, $sym, @_); | ||
} | ||
|
||
sub time () { | ||
if (defined $FakeTime::time) { | ||
#require Carp; Carp::carp("Faked time: $FakeTime::time"); | ||
$FakeTime::time; | ||
} else { | ||
CORE::time(); | ||
} | ||
} | ||
|
||
sub freeze { | ||
$FakeTime::time = CORE::time(); | ||
} | ||
|
||
sub unfreeze { | ||
undef $FakeTime::time; | ||
} | ||
|
||
1; | ||
|
||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters