Skip Menu |

This queue is for tickets about the Variable-Magic CPAN distribution.

Report information
The Basics
Id: 88095
Status: rejected
Priority: 0/
Queue: Variable-Magic

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Return value of `get` magic
Although the documentation says that only the return value of `len` is significant, what I've found is that if you return $_[0] from `get` magic, all is well; but if you return anything else you occasionally get "not numeric" warnings. Is this a known issue? If not, I can attempt to put together a minimal test case.
Hello to you too, While the return value of a magic callback holds no meaning except for 'len' magic, it is actually not ignored by Variable::Magic : it gets coerced into a C integer that is handled back to perl (which usually does nothing out of it). This coercion step causes the "non numeric" warnings you're seeing when you're not returning a scalar that looks like a number. Returning $_[0] doesn't trigger the warning because it is a reference to the magical value, which silently numifies to its C address. I believe the documentation is pretty clear about this, but I'm open to suggestions if you have a better wording about this part. Vincent
Reading the documentation again now, I can't imagine how I missed it. It seems pretty clear.
Closing.