NAME
MooX::CalcTime::Role - calculate total time that a program run
VERSION
version 0.0.6
SYNOPSIS
package AA;
with 'MooX::CalcTime::Role';
sub run {
my $self = shift;
# return second passed, such as 30
$self->get_run_second;
# return a string such as 'Running time: 3 days 2 minutes 1 hours 10 minutes 5 second';
$self->get_runtime_format; # return a variable: '3 days 2 hours 1 minute'
# print return value of 'get_runtime_format' function
$self->print_runtime;
}
DESCRIPTION
This Role is used to inject time related method to other class, So that we can obtain running time more easily.
METHODS
get_run_second
get total seconds passed from consumer class initialize to now.
get_runtime
get total seconds, which passed from consumer class initialize to now, in a format of 'Running time: 8 days 4 hours 3 minutes 30 seconds'.
print_runtime
print total seconds, which passed from consumer class initialize to now, in a format of 'Running time: 8 days 4 hours 3 minutes 30 seconds'.
AUTHOR
Yan Xueqing <yanxueqing621@163.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Yan Xueqing.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.