support for list assignment to pseudohashes (from John Tobey
[p5sagit/p5-mst-13.2.git] / lib / overload.pm
index 6508ad1..1d8f1a1 100644 (file)
@@ -87,7 +87,7 @@ sub AddrRef {
 }
 
 sub StrVal {
-  (OverloadedStringify($_[0])) ?
+  (OverloadedStringify($_[0]) or ref($_[0]) eq 'Regexp') ?
     (AddrRef(shift)) :
     "$_[0]";
 }
@@ -113,9 +113,9 @@ sub mycan {                         # Real can would leave stubs.
 
 %ops = ( with_assign     => "+ - * / % ** << >> x .",
         assign           => "+= -= *= /= %= **= <<= >>= x= .=",
-        str_comparison   => "< <= >  >= == !=",
+        num_comparison   => "< <= >  >= == !=",
         '3way_comparison'=> "<=> cmp",
-        num_comparison   => "lt le gt ge eq ne",
+        str_comparison   => "lt le gt ge eq ne",
         binary           => "& | ^",
         unary            => "neg ! ~",
         mutators         => '++ --',
@@ -169,13 +169,6 @@ overload - Package for overloading perl operations
     ...
     $strval = overload::StrVal $b;
 
-=head1 CAVEAT SCRIPTOR
-
-Overloading of operators is a subject not to be taken lightly.
-Neither its precise implementation, syntax, nor semantics are
-100% endorsed by Larry Wall.  So any of these may be changed 
-at some point in the future.
-
 =head1 DESCRIPTION
 
 =head2 Declaration of overloaded functions
@@ -403,9 +396,9 @@ A computer-readable form of the above table is available in the hash
 
  with_assign     => '+ - * / % ** << >> x .',
  assign                  => '+= -= *= /= %= **= <<= >>= x= .=',
- str_comparison          => '< <= > >= == !=',
+ num_comparison          => '< <= > >= == !=',
  '3way_comparison'=> '<=> cmp',
- num_comparison          => 'lt le gt ge eq ne',
+ str_comparison          => 'lt le gt ge eq ne',
  binary                  => '& | ^',
  unary           => 'neg ! ~',
  mutators        => '++ --',