New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of UNIVERSAL::can #8
Comments
Can you explain this a bit more, I'm not very familiar with AUTOLOAD. How does the $ctx object have the can method? |
This package uses From http://perldoc.perl.org/UNIVERSAL.html you can see:
If $obj is a blessed object into say package My::Package, perl tries to However, as this effectively means you are creating methods at runtime, I have the data stored in the blessed hash of a sub-class of
When this failed, I tried
This fails however because of the test
which is a little clumsy. Hope this helps. |
That makes a ton of sense, should be an easy patch - I just added dotted paths. I'll update my pull request to include this. |
I'm submitting a patch to use $context->can() but I have a question on the spec. The implementation as I have it will always call method on objects and ignore properties even if they exist. I can't find test cases in the spec that cover this so I'm not sure what the behavior should be, but this seems less then ideal. |
…e able to work well with classes that make use of AUTOLOAD
This is correct behaviour, in my opinion. It's then up to the consumer to ensure that the |
It's also according to the spec =) |
In sub lookup, you use
UNIVERSAL::can($ctx, $field)
. This defeats the use of AUTOLOAD to provide parameters.If it could be changed to
$ctx->can($field)
it would mean that it would be possible to overloadcan
in the subclass to make AUTOLOAD work.The text was updated successfully, but these errors were encountered: