Open dnmfarrell opened 8 years ago
Parameters enclosed in the [
and ]
notation are optional and can be omitted. I have tried to use this notation consistently in Time::Moment where the value of the named parameter shows the default:
$tm = Time::Moment->from_string($string [, lenient => false]);
$tm = Time::Moment->from_epoch($seconds [, nanosecond => 0] [, precision => 6]);
$tm = Time::Moment->from_rd($rd [, offset => 0] [, precision => 3] [, epoch => 0]);
$tm = Time::Moment->from_jd($jd [, precision => 3] [, epoch => -1721424.5]);
$tm = Time::Moment->from_mjd($mjd [, precision => 3] [, epoch => 678576]);
I'm open for ideas how to improve the notation or clarify the current notation.
I think @dnmfarrell was pointing out the use of the bareword false
rather than the square brackets. I believe that should be 0
.
Just saw a project that depends on Time::Moment using boolean to get the false
object which doesn't appear to be needed, this works fine:
perl -MTime::Moment \
-e 'print Time::Moment->from_string("2017-03-27 04:53:03.452374Z", lenient => 1)'
In the main module documentation the lenient example appears to be wrong:
Should it be:
?
E.g.