NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
can_ok() (Score:1)
Perhaps the failing test exposed a need to override
UNIVERSAL::can()?Re:can_ok() (Score:2)
Can you give me some suggestions? In this case, CGI::header() is autoloaded. I could override UNIVERSAL::can() to try and call the method first to force the autoload, but what if the method has side effects? Regardless, I'll be calling it after the can_ok() function, so I think that's probably not a big deal, but I can see instances (e.g., with an autoloaded iterator), where this may not be optimal behavior. Offhand, I can't think of anything in CGI.pm where this would be a problem, though. Interesting
Re:can_ok() (Score:1)
The simplest thing that could possibly work is to make a list of autoloaded methods and stick them into a hash. That turns
can()into a hash lookup. From there, you're a bit limited on the available refactorings... you don't have a lot of good options to modify CGI.pm. That doesn't mean you can't take the first step, though.