Is this the maintenance channel?
(it seems so from the perl.vim ftplugin)
Two suggestions that seem a) easy enough to implement, b) strong enough and then a few questions
CHANGE PROPOSAL:
1) ignore comments in include (and define)
The change:
prepend ^\\s*[^#]*\\s* to the existing include and define options
This will let include ignore most commented out options
2) allow includeexpr to work with locally included files
Example
This fails currently, as the existing includeexpr attempts to construct a system level path
I'd suggest using a real as opposed to inline function.
a) It's easier to follow
b) it's hidden away in an ftplugin
c) It's a lot easier to build more complicated logic
In this case a simple branch on whether there is a double colon should suffice.
QUESTIONS:
1) Why is the define option so very broad?
I'd guess this is an effort to catch some odd edge case, but it seems problematic.
Is there a reason why it's not something like
setlocal define=^\\s*[^#]*\\s*\\(my\\s\\+\\\\|sub\\s\\+\\\\|constant\\s\\+\\)
2) Is there a way to work around the vast recursion that the existing include produce?
On my system checkpath on a perl file will lock up my computer for a minute or more.
This seems a combination of
a) a large number of files to check
b) No limits on recursion
c) Perl's overloading of "use" to include meta-directives (warn, strict etc) that are not relevant
d) Perls (strong) pattern of re-using as much as possible.