From cf8ce7dc52d30fee7e20cac004f9438496801687 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Thu, 2 Dec 2021 23:11:14 +0100 Subject: [PATCH] Document parse_amount --- lib/RevBank/Amount.pod | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/RevBank/Amount.pod b/lib/RevBank/Amount.pod index 464ba14..244398f 100644 --- a/lib/RevBank/Amount.pod +++ b/lib/RevBank/Amount.pod @@ -4,6 +4,8 @@ RevBank::Amount - Fixed point 2-decimal numeric values that DWYM =head1 SYNOPSIS + $amount = parse_amount("1.23"); # in plugins, best to use this + $amount = RevBank::Amount->new(30); # 0.30 $amount = RevBank::Amount->parse_string("0.30"); # 0.30 @@ -51,6 +53,16 @@ do that), strange things can happen. Also, "-0.00" is annoying... Note: this class does not play nice with other classes that use operator overloading. +=head2 Functions + +=head3 parse_amount + +Provided by RevBank::Global, and available in plugins. Unlike the +method C<< RevBank::Amount->parse_string >>, the function C will +not allow negative numbers, which is typically a good idea to maintain sanity. +When writing plugins, you should strongly consider providing two different +commands instead of allowing negative numbers. + =head2 Constructors =head3 new