NAME
Text::Editor::Easy::File_manager - Management of the data that is edited.
VERSION
Version 0.40
SYNOPSIS
By complexity order, this module, I think, is the third.
If you create a "Text::Editor::Easy" object, this module will be called very often (but you don't even have to know that this module exists, thanks to "Text::Editor::Easy::Comm").
It manages "file" or "memory" data in a very lazy way. Too lazy for now. I'm going to ask more to this module soon.
You can read data from the start of the file, from the bottom, from the middle, ... from where you want in fact. I just use the "seek" instruction for that. You can read a line, its next or its previous.
This module is lazy because it doesn't read the file even once. I will change this to compute the line number and put some references in order to access faster to a given line number (with an interuptible long task at start).
If you modify a line that is on a file, well it has to work (reluctantly !). It puts the line in memory and will never fetch this line any more from the file.
When you save a modified file, it reads data from the initial file (for non-modified lines) or from memory (when modified), create a new file and when finished, move the new file to the initial.
There is a little drawback : you need more disk space than an Editor which would load everything into memory. The big advantage is that this module don't waste time reading uninteresting data : it reads only on the file the part you can see on the screen. Said like that, this seems obvious not to ask more to your computer. But most Editors think it's useful to read everything (well, it's surely because most programmers don't want to manage the complexity !). And when the file is huge, your entire system blocks. This seems stupid, because who is able to watch several Go of text data in a single day ? Well, I should say in a single year : but, nowadays, with cheap hard drives, most people don't know any more what can contain 1 Go of text data.
FUNCTIONS
clean
close
create_ref_current
delete_and_return_first
delete_line
display
editor_number
Return the line of a Text::Editor::Easy instance given its number. This task may be long for the moment (with huge file), so lazy mode is possible. At the beginning, this task was done outside this module, because sub "anything_for" was not written. Lazy processing can now be transmitted between threads : this means that one thread can stop its processing if another thread receives a new task.
editor_search
Return the line of a Text::Editor::Easy instance and the position (start and end) in this line that match the regexp given. This task may be long (with huge file), so lazy mode is possible.
empty_internal
empty_internal
first_
get_line_number_from_ref
get_next_ref
get_ref_and_text_from_line_ref
get_ref_for_empty_structure
get_text_from_ref
init_file_manager
init_read
last_
line_seek_start
load_info
manage_requests
modify_line
new_line
next_
next_line
prev_line
previous_
previous_line
query_segments
read_
read_line_ref
read_next
read_previous_
read_until
read_until2
ref_of_read_next
revert_internal
save_info
save_info_on_file
save_internal
save_line
save_line_number
COPYRIGHT & LICENSE
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.