diff options
-rw-r--r-- | docs/design-api | 6 | ||||
-rw-r--r-- | perl/Wallet/Object/Base.pm | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/docs/design-api b/docs/design-api index 6e483b9..c0af5d5 100644 --- a/docs/design-api +++ b/docs/design-api @@ -32,8 +32,10 @@ Object API backend has custom attributes, you will need to override this method. If no other arguments besides ATTRIBUTE are given, returns the values - of that attribute, if any, as a list. On error, returns a list - containing one undefined element; (undef), in other words. + of that attribute, if any, as a list. To distinguish between the + empty attribute list and an error, be sure to undefine $self->{error} + at the start of the method and only set the error on failure so that + the caller can call error() to determine if there was a a failure. If other arguments are given, sets the given ATTRIBUTE values to VALUES, which must be a reference to an array (even if only one value diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm index b366d6e..fff06f4 100644 --- a/perl/Wallet/Object/Base.pm +++ b/perl/Wallet/Object/Base.pm @@ -646,8 +646,9 @@ be an attribute type known to the underlying object implementation. The default implementation of this method rejects all attributes as unknown. If no other arguments besides ATTRIBUTE are given, returns the values of -that attribute, if any, as a list. On error, returns a list containing one -undefined element. +that attribute, if any, as a list. On error, returns the empty list. To +distinguish between an error and an empty return, call error() afterwards. +It is guaranteed to return undef unless there was an error. If other arguments are given, sets the given ATTRIBUTE values to VALUES, which must be a reference to an array (even if only one value is being set). |