[Raleigh-talk] Messing around with symbol tables
Paul Bennett
paul.w.bennett at gmail.com
Thu Dec 3 07:00:34 PST 2009
On Wed, 02 Dec 2009 12:13:28 -0500, Michael Peters <mpeters at plusthree.com>
wrote:
> On 12/02/2009 12:05 PM, Paul Bennett wrote:
>> I disagree. What if "$orig"::can() is overriden with something utterly
>> unlike capability testing? It would be outside what I consider safe,
>> sane, and consensual, but not implausible.
>
> The alternative is that if a module purposefully overrides can() so that
> it behaves well (like for instance it has an AUTOLOAD method that can
> dispatch cmp and clone) then your usage would fail. So the module author
> tried to do the right thing but now it won't work because you ignored it.
You make a(n infuriatingly ;-) good point. I thought UNIVERSAL::can() was
smart enough to check AUTOLOAD(), but it's certainly not going to check
AUTOMETHOD() in Class::Std classes (for just one particularly
close-to-home trivial example).
I don't see a PBP for capability checking (maybe I'm just not looking hard
enough), so if anyone's got any ideas about what recommendations are out
there, I'd love to hear about them. For now, I'm checking
(UNIVERSAL::can() || $orig->can()), but that makes me uneasy on some
hard-to-define gut level.
Thanks,
--
Paul
More information about the Raleigh-talk
mailing list