note
chromatic
<blockquote><em>If I want to have <c>can</c> awareness I would have to overload <c>can</c>.</em></blockquote>
<p>You can also predeclare the subs you want to AUTOLOAD.</p>
<blockquote><em>That can be tricky business.</em></blockquote>
<p>Not really. If your <c>AUTOLOAD</c> has some logic to determine whether it <em>should</em> generate a subroutine, you can factor that logic into a subroutine shared between <c>AUTOLOAD</c> and an overridden <c>can</c>.</p>
<p>You don't even have to go through gyrations in <c>can</c> to return a reference. Perl 5 autovivifies subroutines if you take references to them in the appropriate way. Of course, you can also factor out the code which installs the reference and share it between <c>can</c> and <c>AUTOLOAD</c>.</p>
792087
792087