I'm a month late, but here goes:
* Robert Rothenberg [EMAIL PROTECTED] [2004-11-14 15:21]:
sub is_string_like {
return 1,
unless (defined $_[0] ref $_[0]);
# We don't evaluate whether the . and .= operators are
# supported, since for many applications that use strings, the
I'd have to double-check the overload documentation again, but I don't think
overload derives cmp from string conversion, so you have to check for cmp as well.
It doesn't seem to work. I think because the method isn't named '', it's
just how it's set up with overload. (I have not delved into
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
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
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
#