Module Class::Stringify?

2004-11-14 Thread Robert Rothenberg
I've noticed that when authors validate string values as inputs, they often check that the value is not a reference. The problem is that it disallows objects that are overloaded to behave like strings. It's relatively easy to check that an object behaves like a string, and I have some code

Re: Module Class::Stringify?

2004-11-14 Thread Robert Rothenberg
In reading the overload manpage again, I realized that it attempts to define the comparison operators based on cmp operator if they are not there. (Or is supposed to, though some of my tests on the subroutine below show that it fails if not all of the comparisons are defined.) On 14/11/2004

Re: Module Class::Stringify?

2004-11-14 Thread Tim Bunce
On Sun, Nov 14, 2004 at 09:21:17AM -0500, Robert Rothenberg wrote: Reference: some code for testing if an argument is string-like: sub is_string_like { return 1, why the comma? unless (defined $_[0] ref $_[0]); # We don't evaluate whether the . and .= operators are #