NAME
Tie::Scalar::Epoch - Create a scalar that always returns the number of non-leap seconds since whatever time the system considers to be the epoch.
SYNOPSIS
# create a variable and tie
tie my $epoch, 'Tie::Scalar::Epoch';
print "$epoch\n"; # eg. 1351113480
sleep 2; # wait 2 seconds...
print "$epoch\n"; # ... 1351113482
# this will die; $epoch is a readonly variable
$epoch = '2012';
# don't die if no_die is true
tie my $epoch, 'Tie::Scalar::Epoch', { no_die => 1 };
$epoch = '2012';
DESCRIPTION
This is a very simple class that creates readonly scalars that always return the current epoch.
A variables tied to this class is readonly, and attempting to assign to it will raise an exception.
OPTIONS
The following options can be passed in a hashref to tie
.
no_die
-
Do not throw an exception when attempting to assign to a tied scalar. This module will still emit a warning if you have warnings enabled.
SEE ALSO
AUTHOR
Victor Houston, <vichouston@cpan.org>
COPYRIGHT AND LICENSE
Copyright ©2012 by Victor Houston.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.