| Issue 26: | Allow for safe method chaining by providing magic dummy objects | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Consider the following situation $orders = $dbrh -> orders->get(\@orderids); # Might return null $order = $orders->next; # might return false instead of a record say "Status ", $order->status; # might be a null ref say "Source name ", $order->source->name; # doubly so There are at least three places where this code could fail due to null references. Instead of returning false to indicate no record(s) found, return a magic object. This object should use overload to return a false value in scalar context, but still allow the above code to work and prevent null ref errors.
Jun 26, 2009
#1
daniel.d...@gmail.com
Status:
Fixed
|