From f40eda13a0d3d10c1ea1580fa2aab56adc4c4ac7 Mon Sep 17 00:00:00 2001 From: Nadim Khemir Date: Wed, 6 Dec 2023 14:35:53 +0100 Subject: [PATCH] CHANGED: text output goes to STDERR --- Astar/path_finder | 2 +- lib/App/Asciio/Actions/Clipboard.pm | 4 ++-- lib/App/Asciio/Actions/Debug.pm | 6 ++--- lib/App/Asciio/Actions/Presentation.pm | 24 ++++++++++---------- lib/App/Asciio/Actions/Unsorted.pm | 8 +++---- lib/App/Asciio/Arrows.pm | 2 +- lib/App/Asciio/Dialogs.pm | 16 ++++++------- lib/App/Asciio/GTK/Asciio.pm | 6 ++--- lib/App/Asciio/GTK/Asciio/DnD.pm | 2 +- lib/App/Asciio/GTK/Asciio/Menues.pm | 2 +- lib/App/Asciio/Io.pm | 2 +- lib/App/Asciio/Scripting.pm | 10 ++++---- lib/App/Asciio/Server.pm | 12 +++++----- lib/App/Asciio/Text/Asciio/Menues.pm | 2 +- lib/App/Asciio/ZBuffer.pm | 8 +++---- lib/App/Asciio/stripes/section_wirl_arrow.pm | 2 +- setup/hooks/canonize_connections.pl | 2 +- setup/import_export/perl.pl | 2 +- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Astar/path_finder b/Astar/path_finder index 47ffd4dd..b4ae75bf 100755 --- a/Astar/path_finder +++ b/Astar/path_finder @@ -724,7 +724,7 @@ if($options->{info}) if($options->{stats}) { use Data::TreeDumper ; - print DumpTree \%stats, "stats:", DISPLAY_ADDRESS => 0 ; + print STDERR DumpTree \%stats, "stats:", DISPLAY_ADDRESS => 0 ; } if($options->{json}) diff --git a/lib/App/Asciio/Actions/Clipboard.pm b/lib/App/Asciio/Actions/Clipboard.pm index 89f987a0..92cdde3e 100644 --- a/lib/App/Asciio/Actions/Clipboard.pm +++ b/lib/App/Asciio/Actions/Clipboard.pm @@ -124,7 +124,7 @@ for my $option (@clipboard_out_options) { my $elements_base64 = qx~xsel $option -o~ ; - # print "get data:==>" . $elements_base64 . "\n" ; + # print STDERR "get data:==>" . $elements_base64 . "\n" ; $elements_serail = MIME::Base64::decode_base64($elements_base64) ; @@ -135,7 +135,7 @@ for my $option (@clipboard_out_options) } else { - print "data from $option is invalid!\n" ; + print STDERR "data from $option is invalid!\n" ; } } diff --git a/lib/App/Asciio/Actions/Debug.pm b/lib/App/Asciio/Actions/Debug.pm index 33b867cc..fe0c5df1 100644 --- a/lib/App/Asciio/Actions/Debug.pm +++ b/lib/App/Asciio/Actions/Debug.pm @@ -15,7 +15,7 @@ my $size = sum(map { length } @{$self->{DO_STACK}}) || 0 ; local $self->{DO_STACK} = scalar(@{$self->{DO_STACK}}) . " [$size]"; -#~ print Data::TreeDumper::DumpTree $self ; +#~ print STDERR Data::TreeDumper::DumpTree $self ; $self->show_dump_window($self, 'asciio') ; } @@ -25,7 +25,7 @@ sub dump_selected_elements { my ($self) = @_ ; -#~ print Data::TreeDumper::DumpTree [$self->get_selected_elements(1)] ; +#~ print STDERR Data::TreeDumper::DumpTree [$self->get_selected_elements(1)] ; $self->show_dump_window([$self->get_selected_elements(1)], 'asciio selected elements') ; } @@ -35,7 +35,7 @@ sub dump_all_elements { my ($self) = @_ ; -#~ print Data::TreeDumper::DumpTree $self->{ELEMENTS} ; +#~ print STDERR Data::TreeDumper::DumpTree $self->{ELEMENTS} ; $self->show_dump_window($self->{ELEMENTS}, 'asciio elements') ; } diff --git a/lib/App/Asciio/Actions/Presentation.pm b/lib/App/Asciio/Actions/Presentation.pm index 185391da..286d632f 100644 --- a/lib/App/Asciio/Actions/Presentation.pm +++ b/lib/App/Asciio/Actions/Presentation.pm @@ -34,13 +34,13 @@ sub run_slide my ($self, $slide) = @_ ; # use Data::TreeDumper ; -# print DumpTree \@stack, 'stack:' ; +# print STDERR DumpTree \@stack, 'stack:' ; if(defined $slide) { for my $element ($slide->@*) { - # print "running element: $element '" . ref($element) . "' $slide\n" ; + # print STDERR "running element: $element '" . ref($element) . "' $slide\n" ; if('' eq ref($element)) { @@ -57,7 +57,7 @@ if(defined $slide) if('ARRAY' eq ref($element)) { - # print "PUSH $element\n" ; + # print STDERR "PUSH $element\n" ; push @stack, [0, $element] ; run_slide($self, $element) ; @@ -68,7 +68,7 @@ if(defined $slide) if('HASH' eq ref($element)) { $stack[-1][2] = $element ; - print "Asciio: slide has scripts\n" ; + print STDERR "Asciio: slide has scripts\n" ; } $stack[-1][0]++ ; @@ -86,18 +86,18 @@ if(@stack) { my ($index, $slide) = $stack[-1]->@* ; - # print "$index < " . $slide->@* . "\n" ; + # print STDERR "$index < " . $slide->@* . "\n" ; if($index < $slide->@*) { - # print "NEXT\n" ; + # print STDERR "NEXT\n" ; $stack[-1][0]++ ; my $next_slide = $slide->[$index + 1] ; if('ARRAY' eq ref($next_slide)) { - # print "PUSH $next_slide\n" ; + # print STDERR "PUSH $next_slide\n" ; push @stack, [0, $next_slide] ; } @@ -107,7 +107,7 @@ if(@stack) { if(@stack > 1) { - # print "POP\n" ; + # print STDERR "POP\n" ; pop @stack ; next_slide($self) ; @@ -122,8 +122,8 @@ sub previous_slide { my ($self) = @_ ; -use Data::TreeDumper ; -print DumpTree \@stack, 'stack:' ; +# use Data::TreeDumper ; +# print STDERR DumpTree \@stack, 'stack:' ; if(@stack) { @@ -133,8 +133,8 @@ if(@stack) my $slides = $stack[0][1] ; my $index = $stack[0][0] >= $stack[0][1]->@* ? $stack[0][0] - 2 : $stack[0][0] - 1 ; -print "new index: $index\n" ; - + # print STDERR "new index: $index\n" ; + if($index >= 0) { $stack[0][0] = $index ; diff --git a/lib/App/Asciio/Actions/Unsorted.pm b/lib/App/Asciio/Actions/Unsorted.pm index 79ca65a2..25bc14ef 100644 --- a/lib/App/Asciio/Actions/Unsorted.pm +++ b/lib/App/Asciio/Actions/Unsorted.pm @@ -210,7 +210,7 @@ sub display_commands { my ($self) = @_ ; -#~ print Data::TreeDumper::DumpTree $self->{ACTIONS_BY_NAME}, 'ACTIONS_BY_NAME:'; +#~ print STDERR Data::TreeDumper::DumpTree $self->{ACTIONS_BY_NAME}, 'ACTIONS_BY_NAME:'; my $commands = get_commands($self->{ACTIONS_BY_NAME}) ; @@ -338,8 +338,8 @@ for my $action (keys %{$key_mapping}) generate_keyboard_mapping_text_dump($key_mapping->{$action}, $sub_actions) ; } - #~ print Data::TreeDumper::DumpTree $key_mapping->{$action} ; - #~ print Data::TreeDumper::DumpTree $sub_actions ; + #~ print STDERR Data::TreeDumper::DumpTree $key_mapping->{$action} ; + #~ print STDERR Data::TreeDumper::DumpTree $sub_actions ; my $shortcuts = $key_mapping->{$action}{SHORTCUTS} ; $shortcuts = join(' ', @{$key_mapping->{$action}{SHORTCUTS}}) @@ -350,7 +350,7 @@ for my $action (keys %{$key_mapping}) } else { - #~ print Data::TreeDumper::DumpTree $key_mapping->{$action}, $action ; + #~ print STDERR Data::TreeDumper::DumpTree $key_mapping->{$action}, $action ; #~ die "unknown type while running 'dump_keyboard_mapping'\n" ; } } diff --git a/lib/App/Asciio/Arrows.pm b/lib/App/Asciio/Arrows.pm index 30ae5c62..f5b23f16 100644 --- a/lib/App/Asciio/Arrows.pm +++ b/lib/App/Asciio/Arrows.pm @@ -283,6 +283,6 @@ if(exists $arrow_types{$data->{TYPE}}) } } -sub clone { my ($type) = @_ ; print "cloning arrow $type\n" ; Clone::clone($arrow_types{$type}) ; } +sub clone { my ($type) = @_ ; print STDERR "cloning arrow $type\n" ; Clone::clone($arrow_types{$type}) ; } } diff --git a/lib/App/Asciio/Dialogs.pm b/lib/App/Asciio/Dialogs.pm index 97054e5e..3f0265b5 100644 --- a/lib/App/Asciio/Dialogs.pm +++ b/lib/App/Asciio/Dialogs.pm @@ -22,7 +22,7 @@ sub show_dump_window { my ($self, $data, $title, @dumper_setup) = @_ ; -print DumpTree $data, $title, @dumper_setup ; +print STDERR DumpTree $data, $title, @dumper_setup ; } #----------------------------------------------------------------------------- @@ -31,7 +31,7 @@ sub display_message_modal { my ($self, $message) = @_ ; -print $message ; +print STDERR $message ; } #----------------------------------------------------------------------------- @@ -40,9 +40,9 @@ sub display_yes_no_cancel_dialog { my ($self, $title, $text) = @_ ; -print "$title\n$text\n" ; +print STDERR "$title\n$text\n" ; -print "Yes/No/Cancel\n" ; +print STDERR "Yes/No/Cancel\n" ; my $answer = ; chomp ($answer) ; @@ -55,8 +55,8 @@ sub display_quit_dialog { my ($self, $title, $text) = @_ ; -print "$title\n$text\n" ; -print "Yes/No/Cancel\n" ; +print STDERR "$title\n$text\n" ; +print STDERR "Yes/No/Cancel\n" ; my $answer = ; chomp ($answer) ; @@ -68,7 +68,7 @@ sub display_edit_dialog { my ($self, $title, $text) = @_ ; -print "$title\n$text\n" ; +print STDERR "$title\n$text\n" ; my $answer = ; chomp ($answer) ; @@ -82,7 +82,7 @@ sub get_file_name { my ($self, $title, $mode, $directory) = @_ ; -print "get_file_name:\n" ; +print STDERR "get_file_name:\n" ; my $answer = ; chomp ($answer) ; diff --git a/lib/App/Asciio/GTK/Asciio.pm b/lib/App/Asciio/GTK/Asciio.pm index bdc9c999..e5cd467d 100644 --- a/lib/App/Asciio/GTK/Asciio.pm +++ b/lib/App/Asciio/GTK/Asciio.pm @@ -161,7 +161,7 @@ my ($widget_width, $widget_height) = ($widget->get_allocated_width(), $widget->g # use Data::TreeDumper ; # my $neighbors = $zbuffer->get_neighbors_stack($coordinate) ; -# print DumpTree { stack => $elements, neighbors => $neighbors }, $coordinate ; +# print STDERR DumpTree { stack => $elements, neighbors => $neighbors }, $coordinate ; # } my $grid_rendering = $self->{CACHE}{GRID} ; @@ -593,7 +593,7 @@ for (@overlay_elements) { if(! defined $_) { - print "GTK::Asciio: got undef\n" ; + print STDERR "GTK::Asciio: got undef\n" ; } elsif(ref $_ eq 'ARRAY') { @@ -621,7 +621,7 @@ for (@overlay_elements) } else { - print "GTK::Asciio: got someting else " . ref($_) . "\n" ; + print STDERR "GTK::Asciio: got someting else " . ref($_) . "\n" ; } } # draw hint_lines diff --git a/lib/App/Asciio/GTK/Asciio/DnD.pm b/lib/App/Asciio/GTK/Asciio/DnD.pm index 92b260a8..7b393b75 100644 --- a/lib/App/Asciio/GTK/Asciio/DnD.pm +++ b/lib/App/Asciio/GTK/Asciio/DnD.pm @@ -43,7 +43,7 @@ $window->drag_dest_set_target_list($target_list) ; $window->signal_connect(drag_data_received => \&drag_data_received_cb, $self) ; -# $window->signal_connect(drag_motion => sub{ print "drag_motion\n"}, $self) ; +# $window->signal_connect(drag_motion => sub{ print STDERR "drag_motion\n"}, $self) ; $window->signal_connect(drag_end => sub { $self->{IN_DRAG_DROP} = 0 ; }, $self); $window->signal_connect(drag_data_get => \&drag_data_get_cb, $self) ; diff --git a/lib/App/Asciio/GTK/Asciio/Menues.pm b/lib/App/Asciio/GTK/Asciio/Menues.pm index 5a554ca7..b15186d8 100644 --- a/lib/App/Asciio/GTK/Asciio/Menues.pm +++ b/lib/App/Asciio/GTK/Asciio/Menues.pm @@ -137,7 +137,7 @@ for my $context_menu_handler } sort keys %{$self->{ACTIONS}} ) { - # print "Adding context menu from action '$context_menu_handler->{NAME}'.\n" ; + # print STDERR "Adding context menu from action '$context_menu_handler->{NAME}'.\n" ; if(defined $context_menu_handler->{CONTEXT_MENU_ARGUMENTS}) { diff --git a/lib/App/Asciio/Io.pm b/lib/App/Asciio/Io.pm index 3f90e375..6736131a 100644 --- a/lib/App/Asciio/Io.pm +++ b/lib/App/Asciio/Io.pm @@ -159,7 +159,7 @@ for my $new_element (@{$elements}) { if(exists $self->{ELEMENT_TYPES_BY_NAME}{$new_element->{NAME}}) { - print "Overriding element type '$new_element->{NAME}'!\n" ; + print STDERR "Overriding element type '$new_element->{NAME}'!\n" ; $self->{ELEMENT_TYPES}[$self->{ELEMENT_TYPES_BY_NAME}{$new_element->{NAME}}] = $new_element ; } diff --git a/lib/App/Asciio/Scripting.pm b/lib/App/Asciio/Scripting.pm index d70ecc3d..965cb2d2 100644 --- a/lib/App/Asciio/Scripting.pm +++ b/lib/App/Asciio/Scripting.pm @@ -68,7 +68,7 @@ use App::Asciio::stripes::wirl_arrow ; use Digest::MD5 qw(md5_hex) ; use Data::TreeDumper ; -sub ddt { print DumpTree @_ ; } +sub ddt { print STDERR DumpTree @_ ; } use App::Asciio::Actions::Colors ; @@ -91,8 +91,8 @@ if(defined $script) { $external_script_run++ ; - print "Asciio: script [$external_script_run]: " . md5_hex($script) . ' ' . length($script) . "\n" ; - print "$script\n" if $show_script ; + print STDERR "Asciio: script [$external_script_run]: " . md5_hex($script) . ' ' . length($script) . "\n" ; + print STDERR "$script\n" if $show_script ; $script_asciio = $asciio ; @@ -100,7 +100,7 @@ if(defined $script) $asciio->update_display() ; - print "Asciio: error running script: $@ \n" if $@ ; + print STDERR "Asciio: error running script: $@ \n" if $@ ; } } @@ -112,7 +112,7 @@ $file //= $asciio->get_file_name() ; if(defined $file) { - print "Asciio: script file: '$file'\n" ; + print STDERR "Asciio: script file: '$file'\n" ; $script_asciio = $asciio ; diff --git a/lib/App/Asciio/Server.pm b/lib/App/Asciio/Server.pm index 080c9760..d6c2dab3 100644 --- a/lib/App/Asciio/Server.pm +++ b/lib/App/Asciio/Server.pm @@ -87,16 +87,16 @@ else $to_parent->autoflush(1) ; my $daemon = HTTP::Daemon->new(ReusePort => 1, LocalAddr => 'localhost', LocalPort => $port) or die "Server: Error: can't start server\n" ; - print "Asciio: running HTTP server on port $port\n" ; + print STDERR "Asciio: running HTTP server on port $port\n" ; $SIG{INT} = sub { - # print "Asciio: Server received SIGINT\n" ; + # print STDERR "Asciio: Server received SIGINT\n" ; undef $daemon ; } ; $SIG{TERM} = sub { - # print "Asciio: Server received SIGTERM\n" ; + # print STDERR "Asciio: Server received SIGTERM\n" ; undef $daemon ; } ; @@ -113,7 +113,7 @@ else { my $path = $rq->uri->path ; - # print "Asciio: Http: " . $rq->method . ' ' . $daemon->url . "$path, count: $counter - $$\n" ; + # print STDERR "Asciio: Http: " . $rq->method . ' ' . $daemon->url . "$path, count: $counter - $$\n" ; if ($rq->method eq 'GET') { @@ -126,7 +126,7 @@ else my $parser = HTTP::Request::Params->new({req => $rq}) ; my $parameters = $parser->params() ; - # '/' eq $path && print "Asciio:: Web server: POST\n" . DumpTree($parameters) ; + # '/' eq $path && print STDERR "Asciio:: Web server: POST\n" . DumpTree($parameters) ; my $request_json = JSON->new->allow_nonref->canonical(1)->pretty->encode({ PATH => $path, PARAMETERS => $parameters}) ; @@ -146,7 +146,7 @@ else '/stop' eq $path && $stop++ ; - # '/' eq $path && print "Asciio:: Web server: PUT\n" . DumpTree($parameters) ; + # '/' eq $path && print STDERR "Asciio:: Web server: PUT\n" . DumpTree($parameters) ; my $request_json = JSON->new->allow_nonref->canonical(1)->pretty->encode({ PATH => $path, PARAMETERS => $parameters}) ; my $size = length($request_json) ; diff --git a/lib/App/Asciio/Text/Asciio/Menues.pm b/lib/App/Asciio/Text/Asciio/Menues.pm index 2d459c41..1206608b 100644 --- a/lib/App/Asciio/Text/Asciio/Menues.pm +++ b/lib/App/Asciio/Text/Asciio/Menues.pm @@ -156,7 +156,7 @@ for my $context_menu_handler } sort keys %{$self->{CURRENT_ACTIONS}} ) { - # print "Adding context menu from action '$context_menu_handler->{NAME}'.\n" ; + # print STDERR "Adding context menu from action '$context_menu_handler->{NAME}'.\n" ; if(defined $context_menu_handler->{CONTEXT_MENU_ARGUMENTS}) { diff --git a/lib/App/Asciio/ZBuffer.pm b/lib/App/Asciio/ZBuffer.pm index dcdb5309..8511b472 100644 --- a/lib/App/Asciio/ZBuffer.pm +++ b/lib/App/Asciio/ZBuffer.pm @@ -51,7 +51,7 @@ for my $element (@elements) } # my $t1 = Time::HiRes::gettimeofday(); -# printf "add time: %0.4f sec.\n", $t1 - $t0 ; +# printf STDERR "add time: %0.4f sec.\n", $t1 - $t0 ; } # ------------------------------------------------------------------------------ @@ -163,10 +163,10 @@ while ( my ($coordinate, $char) = each $self->{coordinates}->%*) # $rendering .= "${coordinate}->$char\n" ; } -print "$rendering\e[m" ; +print STDERR "$rendering\e[m" ; # my $t1 = Time::HiRes::gettimeofday(); -# printf "render time: %0.4f sec.\n", $t1 - $t0 ; +# printf STDERR "render time: %0.4f sec.\n", $t1 - $t0 ; } # ------------------------------------------------------------------------------ @@ -205,7 +205,7 @@ while( my($coordinate, $elements) = each $zbuffer->{intersecting_elements}->%*) { my $neighbors = $zbuffer->get_neighbors($coordinate) ; - print DumpTree { stack => $elements, neighbors => $neighbors }, $coordinate ; + print STDERR DumpTree { stack => $elements, neighbors => $neighbors }, $coordinate ; # compute overlay } } diff --git a/lib/App/Asciio/stripes/section_wirl_arrow.pm b/lib/App/Asciio/stripes/section_wirl_arrow.pm index a30c40dd..fd45be73 100644 --- a/lib/App/Asciio/stripes/section_wirl_arrow.pm +++ b/lib/App/Asciio/stripes/section_wirl_arrow.pm @@ -646,7 +646,7 @@ if(defined $start_element) if($is_start) { - #~ print "Moving start connector\n" ; + #~ print STDERR "Moving start connector\n" ; ($start_x_offset, $start_y_offset) = $start_element->resize diff --git a/setup/hooks/canonize_connections.pl b/setup/hooks/canonize_connections.pl index b6366fb5..0d00b91e 100644 --- a/setup/hooks/canonize_connections.pl +++ b/setup/hooks/canonize_connections.pl @@ -237,7 +237,7 @@ sub reconnect my $y_offset_to_connection = ($connectee->{Y} + $connection->{Y}) - ($connected->{Y} + $connector->{Y}) ; # move connector - #~ print "reconnect: $connection_name $connector_name\n" ; + #~ print STDERR "reconnect: $connection_name $connector_name\n" ; my ($x_offset, $y_offset, $width, $height, $new_connector) = $connected->move_connector($connector_name, $x_offset_to_connection, $y_offset_to_connection, $hint) ; diff --git a/setup/import_export/perl.pl b/setup/import_export/perl.pl index b3c9d8ff..449c5e56 100644 --- a/setup/import_export/perl.pl +++ b/setup/import_export/perl.pl @@ -106,7 +106,7 @@ sub get_base64_data my $asciio_header = shift @asciio_lines ; #~ use Data::TreeDumper ; -#~ print DumpTree \@asciio_lines, 'asciio_lines' ; +#~ print STDERR DumpTree \@asciio_lines, 'asciio_lines' ; my $whole_file = read_file($file_name) ;