in reply to proxying overloads: returns seem to lie
Your problem is context.
print operates in interpolative context so $capsule returns It's a widget! but ne operates in boolean context so $capsule returns something like Object::Capsule=SCALAR(0x1234567).
I ran three tests:
- Your code as is
- Changed $capsule ne ... to "$capsule" ne ... (eq also)
- Changed $capsule ne ... to $$capsule ne ... (eq also)
Here's the output using Perl 5.6, Cygwin and Win98:
[ ~/tmp ] $ perl overload_context # capsule overload eval-ing : ${$_[0]} eq $_[1] Segmentation fault (core dumped) [ ~/tmp ] $ perl overload_context # result of comparison: true # result of comparison: false # -- bytes of returned strings -- # 73 116 39 115 32 97 32 119 105 100 103 101 116 33 # 73 116 39 115 32 97 32 119 105 100 103 101 116 33 --(Test::More stuff below this point)-- [ ~/tmp ] $ perl overload_context # result of comparison: true # result of comparison: false # -- bytes of returned strings -- # 73 116 39 115 32 97 32 119 105 100 103 101 116 33 # 73 116 39 115 32 97 32 119 105 100 103 101 116 33 --(Test::More stuff below this point)-- [ ~/tmp ] $
Regards,
PN5
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: proxying overloads: returns seem to lie
by rjbs (Pilgrim) on Sep 11, 2004 at 14:26 UTC | |
by Prior Nacre V (Hermit) on Sep 25, 2004 at 23:26 UTC |
In Section
Seekers of Perl Wisdom