in reply to Re: RFC: Seconds2English
in thread RFC: Seconds2English
Why get that complex? I'd rather:
{ no strict 'refs'; for my $method (qw( seconds minutes hours days weeks months years +)) { *{ $method } = sub { return $_[0]->{ $method } }; *{ 'in_' . $method } = sub { return $_[0]->{ time } / $_[0]->{_table }{ $method } } +} } }
Funny, that ended up quite a bit shorter than I expected.
|
|---|