Source

Kephra / lib / Kephra / Document.pm

Diff from to

File lib/Kephra/Document.pm

 use Moo;
 use Scalar::Util qw(blessed);
 
-my $max_title_width = 15;
-
-# export SUB_QUOTE_DEBUG=1
-
+my $max_title_width = 15;                               # export SUB_QUOTE_DEBUG=1
 
 has ID     => ( is  => 'rwp' );                             # API::Doc ID
 has title  => ( is  => 'rwp' );                             # shown as tab label
 		}
 
 		$self->_set_old_file_path( $self->file_path );
-		#$_->set_page_title( $self->title, $self->panel->{$_} )
-			#for Kephra::API::all_docbars();
+		$_->set_page_title( $self->title, $self->panel->{$_} ) for Kephra::API::all_docbars();
 	});
 has file_dir     => ( is => 'rwp', );
 has file_name    => ( is => 'rwp', );
 has folded_lines => ( is => 'rw', );
 has marked_lines => ( is => 'rw', );
 
+
 sub BUILDARGS {
 	my ( $self, @args ) = @_;
-	unshift @args, "file_path" if @args % 2 == 1;
-	my %args = @args;
+	#unshift @args, "file_path" if @args % 2 == 1;
+	my %args;
+	%args = @args unless scalar @args % 2;
 	$args{'encoding'} = 'utf-8';
 
 	return \%args;
 }
-
 sub BUILD    {
 	my $self = shift;
 	$self->add_instance($_) for Kephra::API::all_docbars();
 	$self->_set_ID( Kephra::API::Doc::add($self) );
 	$self->_set_title('<untitled '.$self->anon_NR.'>') unless $self->file_path;
 }
+sub DEMOLISH { Kephra::API::Doc::remove($_[0]) }
 
-sub DEMOLISH { Kephra::API::Doc::remove($_[0]);# say "demolish $_[0]"; 
-}
 
 sub add_instance {
 	my ($self, $bar) = @_;