XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
My thoughts on your approach (though, I've never actually used any of the Filter:: modules, so I'm by no means an authority :) are that filters should generally be reserved for cases where the desired syntax is not valid Perl or there is some extreme change to the way the valid syntax would work that can't be accomplished any other way. The only things in your example .vim file are the function declaration line and the corresponding endfu (update: er, and the perl <<EOSCRIPT line pair). You ought to be able to accomplish everything else with normal Perl code. For example, you may well be better off simply installing a Msg function in the VIM:: namespace that prints to STDERR. You'd need to define a few functions, and export a few variables/objects, but all-in-all, I think it would come out cleaner and more straight-forward. Also, I think your #NOVIM# construct is reduntant, as you acomplish the same thing earlier in the file using "";. Since you'll have to do that at least once for the line that includes the filter module, you might as well comment it well and use it consistantly. (As a corollary to that, I think that you should probably move the use strict; et al. lines up with the use VimFilter; line, as they conceptually belong together anyway.) Then, I think that the way you're defining the @Dummy array is a bit convoluted. It seems like it would be easier to just pass that information to the VimFilter module as you use it. Then you shouldn't need to scan-and-parse the original source file looking for the declaration line. If I'm correct, this ought to obviate your entire convoluted BEGIN block. Lastly (and it's entirely a matter of preference), since your working with VIM functions anyway, it makes more conceptual sense to translate the func blah and endfu lines into subroutine definitions, instead of just deleting them. It should make no difference in the end, though. *shrug* bbfu In reply to Re: Writing a Filter::Simple -based filter for .vim
by bbfu
|
|