Commits

Herbert Breunung committed 35761f8

updated internals docs

  • Participants
  • Parent commits d941a72

Comments (0)

Files changed (2)

lib/Kephra/File/Local.pm

+use v5.10;
+use strict;
+use warnings;
+use Kephra::API;
+use Kephra::File;
+
+package Kephra::File::Local;
+
+
+sub read {
+	my $doc = shift;
+	my $file = Kephra::File::normalize_path( shift ) || $doc->file_path;
+	return Kephra::Log::warning("can't load nonexising file") unless $file and -e $file;
+	return Kephra::Log::warning("can't read $file") unless -r $file;
+	my $ed = $doc->editor;
+	CORE::open my $FH, '<', $file;
+	binmode($FH);
+	my $content = do { local $/; <$FH> };
+	if ($content) {
+		$ed->SetText( $content );
+		$ed->SetSavePoint;
+	}
+}
+
+sub write {
+	my $doc = shift;
+	my $file = Kephra::File::normalize_path( shift ) || $doc->file_path;
+	return Kephra::Log::warning("need a file path") unless $file;
+	return Kephra::Log::warning("can't overwrite $file") if -e $file and not -w $file;
+	$doc->file_path($file) unless $doc->file_path eq $file;
+	my $ed = $doc->editor;
+	CORE::open my $FH, '>', $file;
+	print $FH $ed->GetText;
+	$ed->SetSavePoint;
+}
+
+
+1;

lib/Kephra/Internals.pod

 
 The module Kephra::API is the best starting point to understand the inner workings.
 Thats's one design goal and purpose of this file, because it gives an overview of
-all important functions and values and shows where they originate. From here
+the most important functions and values and shows where they originate. From here
 you can step to the other major interfaces that can be seen in the first lines.
 
 But more vitally it decouples many cross module calls and allows to change things
 under the hood during smaller release cycles. As long as the first version number
 (see L<Versioning>) does not change, nothing will be removed from the API.
 
-=head2 Kephra::Config
-
-Interface too most not document related internally held data.
-We have a much broader understanding of configuration.
-Even Icons and localisation belong to it.
-Its all data which puts the app in the state it is.
-
-=head2 Kephra::CommandList
-
-Also sort of API but more complex. Contains every call the user is able to make.
-Needed to protocol each call for monitoring, macros and other introspection
-based functions. Also helps to make simple menu and toolbar definitions.
-They just need to be a list of CommandIDs.
-
-=head2 Kephra::KeyMap
-
-handles the mapping from key kommbo to the command it triggeres for any 
-App::Dialog and App::Part
-
-=head2 Kephra::EventTable
-
 
 =head1 NAMESPACES
 
 If you want to leave the recommended ways as proposed by the API
 and call functions or data directly ...
-here is an overview to the Kephra name space organisation.
+here is an overview to the Kephra namespace organisation.
 
-to the namespace Kephra::Doc::* belongs also the module Kephra::Doc
+Please not that as shorter the name is (shorter namespace chain),
+the more internal and general purpose the module is owning that name.
+For instance Kephra::File::Local serves as specialized subtask of Kephra::File.
 
 
 * Kephra
 
 interface to important internal functions all modules and plugins should use
 
+The modules in the Kephra::API::* namespace are services for a more sophisticated
+communication between the modules who do the real work.
+
+Kephra::API::Command
+
+Also sort of API but more complex. Contains every call the user is able to make.
+Needed to protocol each call for monitoring, macros and other introspection
+based functions. Also helps to make simple menu and toolbar definitions.
+They just need to be a list of CommandIDs.
+
+Kephra::API::KeyMap
+
+handles the mapping from key kommbo to the command it triggeres for any 
+App::Dialog and App::Part
+
+Kephra::API::Event
+
+
 * Kephra::App
 
 module that handles boot and shutdown sequence
 
 * Kephra::Config
 
-data structures
+Interface to most not document related internally held data.
+We have a much broader understanding of configuration.
+Even Icons and localisation belong to it.
+Its all data which puts the app in the state it is.
 
 * Kephra::Document