On Mon, 13 Dec 2004, Ben Crowell wrote:
Bulia tells me there will soon be an extensions menu. I'm interested in writing some extensions in Perl. My motivation is to scratch my own itch, but some of the stuff I write might be of interest to other users as well. So far I've just been writing Perl scripts to manipulate SVG files, and running them from the command line.
Cool!
Is there an API for extensions yet? The simplest thing would probably be to do it through a shell, and provide a way to hook the command-line options and arguments up to a dialog box in the GUI. There would need to be provisions for internationalization, and for error reporting (including errors resulting from not having the right Perl modules installed).
I put together a really crude proposal for an API (it's written up somewhere if you're curious), but it's still highly preliminary right now. Bob's work on embedding Perl/Python interpreters is probably closest to fruition. However there is already an existing mechanism for simple STDIN/STDOUT type scripts you could look at taking advantage of right now. I don't think it's very well documented but perhaps looking at the other extensions can give enough clues. If not just ask questions. :-)
However, since Inkscape runs on Windows, running it in a shell might not work.
Possibly, but I think it should be solvable.
Is the Extensions menu envisioned as a Unix-only feature?
No
It seems like it would be quite complicated to implement such a thing on a cross-platform basis. It's easy to write
Cross-platform is always complicated. We do it anyway though. :-)
the scripts to be platform-independent, but, e.g., most Windows users aren't going to have Active State Perl installed, and even if you embedded a Perl interpreter in Inkscape, that would only work for Perl, and there would still be the issue of libraries. Even if you told Windows users they were required to install Perl and a certain set of libraries, it would also be complex to try to write the glue between Inkscape and Perl in a platform-independent way. And my experience from writing a cross-platform Perl app is that it's a lot of work in terms of testing and code maintenance, much more than writing a Unix-only app.
Yup, all excellent and very true points. We don't have very good dependency tracking for perl code, especially on Windows, and you're right that the platform issues in the perl code itself can be a hinderance. But we try to do it anyway, and those users that put in the effort to get things working on their system can benefit from the tools. If you run into platform-dependencies in the Perl code, send a bug report or patch.
Bryce