One of the grants the grant committee approved last year was to extend PPI towards a refactoring editor. At that time, we didn't have procedures in place to take the grant reports and post them to a common spot. Now that we have this blog, our intention is to post these reports regularly so you can see the bang you're getting for your buck.
What follows is Adam Kennedy's report on his PPI work.
One of the biggest talking points about PPI since its initial creation has been the prospect of smarter tools, and in particular getting a PPI-based "refactoring editor".
But the goal for PPI 1.0 was never for it to be useful in an interactive,
performance-critical environment. It was about getting B
This Phase 2 grant is intended primary to allow me to spend some time working on various bits and pieces needed to create these tools, and solve the various problems currently preventing PPI being usable in an editor context.
The end goal for the grant is a proof-of-concept cross-platform refactoring Perl editor, itself implemented in Perl and installable directly from CPAN.
While I don't expect to complete a full featured and polished editor, by providing some examples of the sorts of things that can be done in a Perl refactoring editor, it will inspire others to improve it and take the concept further.
So far, I've made or assisted others to take number of positive steps.
- PPI::Cache has been completed.
It should speed up loading of documents in project trees by a minimum of a factor of 4, more as further optimisations are made.
- PPI is (ASCII) line-noise compatible.
What gets typed into an editor is almost never actually legal Perl, and each keystroke takes the document through strange and evil border cases.
With the assistance of Audrey Tang, you can now throw random ASCII line noise at PPI and it will do whatever it takes to produce B
that is a valid document.
- Taken over and rewritten File::HomeDir
A rewrite of this venerable module means it should now work properly on multiple platforms, and for multiple resource types (documents, application data, etc). It has been tested under the three main Perl-related desktop environment (Win32, Unix, Mac OS X)
- Created File::ShareDir
Distribution installers such as Module::Install can now install shared data files, and the application can find them later. This will make the installation of heavier programs like editors and other applications that require a large amount of shared data files much easier.
- Created File::UserConfig
File::UserConfig wraps around the above two modules. It finds the user's config directory (on all platforms), copying in a defult config directory if it doesn't exist.
- Helping to make Win32 Perl a first class citizen
After some issues with trying to complete PXPerl, I took the approach of running a "vertical metre of beer" competition. With the CamelPack now available (and Vanilla Perl almost here), for the first time we have the chance to create a true cross-platform desktop application for Unix, Win32 and Mac OS X that can be installed from CPAN directly.
- CPANifying the Proton CE Editor
I'll be using the Proton CE editor (to be renamed) as the base for my proof-of-concept editor. Quite a bit of work has been done to take this editor close to the point where it can be distributed via CPAN.
It has been reorganised as a CPAN tarball, and is in the process of being converted to File::Spec and File::UserConfig. It should appear on CPAN shortly.
- Helped create App::GUI::Notepad
Hopefully released by the time you read this, I've worked with Ben Marsh to create a small re-implementation of Notepad that works fully cross-platform and installs directly from CPAN. I set up the structure for the distribution and ensured the depenedencies all install cleanly, and Ben has created application itself and done the WxWindows work.
The amazing Jeffery Thalhammer has produced a great implementation of a scanner for Damien Conways Perl Best Practices Book. I've chipped in with attaboys and various changes to PPI as needed to help out.
Perl::Metrics is done, but is idling in the face of CPAN::Metrics crashing due to memory issues 2-3 times per CPAN run. Left it for now to focus on getting the main editor up and running.
The Proton CE cpanification is progressing fine, heading towards an initial function-neutral release before beginning to add the PPI magic to the editor.
In the mean time, App::GUI::Notepad will serve as the basis for an excellent testing platform and alternative host for the Perl::Editor implementation.
I'd put my current progress at around 80%, with 99% the heavy preliminaries out of the way and only the guts of the editor itself to go.