- COPYRIGHT & LICENSE
Text::Editor::Easy - A perl module to edit perl code with syntax highlighting and more.
There is neither an IDE written in perl, nor designing tools to take benefit from the fact that perl is highly dynamic. A perl IDE should allow, indeed, much more than what classical IDE does. This module is the first part of this tremendous task.
This module enables you to manipulate a highly multi-threaded graphical object. Several demos are provided with this module. To run them and have a glance at the capabilities of this module, launch the perl program "Editor.pl" which only use "Text::Editor::Easy" objects. See README file for installation instructions.
The demos (9 demos to be tested from the "Editor.pl" program) will show you examples of how to call this module.
use Text::Editor::Easy; my $editor = Text::Editor::Easy->new(); ...
This module is object-oriented. Once a instance is created, numerous methods are accessible. New methods can be added on the fly with, why not, new threads associated with these new methods.
Sometimes, you need to consume CPU to achieve your goal. But this shouldn't block the user who interactively use your graphical module : the interface of the module (especially, method "create_new_server") allows you to create threads as simply as you create a new variables. See module "Text::Editor::Easy::Comm" for the thread mecanism.
Threads are not only used for speed. With private variables, they allow you to partition your code. So you don't have a large program with a huge amount of data to manage but a lot of little threads, specialized in a much simpler task with fewer variables to manage. The only remaining problem is how to communicate with all these "working together threads" : the "Text::Editor::Easy::Comm" provide the solution. All you have to do is define a new thread associated with your new methods. When the new methods are called (by any thread, the new created one or any other one), your new thread will be called automatically and the response will be automatically provided to the initial calling thread (in the context of the caller). Easy, isn't it ! Again, see module "Text::Editor::Easy::Comm" for the thread mecanism.
The graphical part of the module is handled mainly by "Text::Editor::Easy::Asbtract". The "Abstract" name has been given because, even if I use Tk for now, there is no Tk calls in all the Abstract module. Tk calls are concentrated in "Text::Editor::Easy::Graphic:Tk_Glue" module : other "Graphic glue" modules are possible. I think of "Gtk", "Console", and why not "Qt" or "OpenGl" ? There is a limited communicating object (a "Text::Editor::Easy::Graphic") between the Abstract module and the glue module : this is the interface. This interface may change a little in order to allow other "Glue module" to be written, but, of course, all graphic glue modules would have to use the same interface. You can see the "Text::Editor::Easy" as a super graphical layer above other layers. I imagine a generator where you design an application in your preferred graphical user interface but the generated application could run (maybe in a limited way) in "Console mode". Constant re-use is the key to hyper-productivity.
Insert text at the end of the "Text::Editor::Easy" instance. Not yet finished (only one line can be inserted, now).
Returns a Cursor object from a "Text::Editor::Easy" instance. See "Text::Editor::Easy::Cursor" for a list of methods available for the Cursor object.
Delete one character. Used with "Text::Editor::Easy::Abstract". Should not be part of the interface...
Allow the use of Line object with the "display" instance method : the internal reference of the Line object, an integer, is given to the display sub of "Text::Editor::Easy::Abstract". Line objects are scalar reference (for encapsulation), and they can't be recovered between threads after a dump of the structure (the substitution is done by the calling thread but the "display execution" is done by the graphical thread with the help of the "File_manager" thread).
Delete one or more characters. Used with "Text::Editor::Easy::Abstract". Should not be part of the interface...
In scalar context, this method returns the name of the file (without the path) if any (undef if the Text::Editor::Easy instance is a memory edition). In list context, returns the absolute path, the file name (without path), the relative path (to current path) and the name of the instance.
Returns a Line object that represents the first line of the "Text::Editor::Easy" instance.
Given the name of a Zone object and a number, this class method returns the instance of the Text::Editor::Easy object if it is found. Undef otherwise :
As "display" method, this sub makes substitution of Line objects. Here, this substitution is made for the return value. If the calling context is a list context, the insert method returns the Line objects that represents the lines that have been inserted. But as Line objects are scalar references (for encapsulation), each thread must have its own addresses of scalar references (the substitution is done by the calling thread but the "insert execution" is done by the graphical thread and the "File_manager" thread).
Class method : returns the editor instance who had the focus when ctrl-f was pressed.
Call to editor_visual_search : replacement of line object (scalar reference, memory adress specific to one thread) by the internal reference of the line (common for all threads).
Class method. Returns a "Text::Editor::Easy" object whose file name is the parameter given.
Class method. Returns a "Text::Editor::Easy" object whose name is the parameter given.
Maybe destroy would be a better name...
<sgrommier at free.fr>
This module is moving fast. Bugs are not yet managed.
Maybe you'd like to know that I writed this Editor from scratch. I didn't take a single line to any existing editor. The very few editors I had a glance at were too tightly linked to a graphical user interface. Maybe you obtain faster execution results like that, but you do not recycle anything. I wanted an engine which you could plug to, a little like perl has been designed.
The best support for this module is the "Editor.pl" program. Read the README file to install the module and launch the "Editor.pl" program.
To be in an editor allows you to display information interactively. Full documentation will be accessible from here with version 1.0.
In future versions, there will be a "video mode" : perl code to make the images and ogg files for the sound. These videos will cost almost nothing in space compared to actual compressed videos (the sound will be, by far, the heaviest part of them).
All softwares should include "help videos" like what I describe : it would prove that what you are about to use is easy to manipulate and it would give you a quick interactive glance of all the possibilities. But most softwares are awfully limited if you want to use them in a "programmatic way" (yet, interactively, it's often very pretty, but I don't mind : I want POWER !). In my ill productive point of view, most softwares should be written again...
Copyright 2008 Sebastien Grommier, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.