@@ -19,10 +19,18 @@ sub setup
1919{
2020my ($self , $setup_ini_files , $object_overrides ) = @_ ;
2121
22+ if (defined $object_overrides )
23+ {
24+ while ( my ($k , $v ) = each $object_overrides -> %* )
25+ {
26+ $self -> {$k } = $v ;
27+ }
28+ }
29+
2230for my $setup_file (@{$setup_ini_files })
2331 {
24- print STDERR " Initializing with '$setup_file '\n " if $self -> {DISPLAY_SETUP_INFORMATION };
25- warn " Asciio: Warning: can't find setup data '$setup_file '\n " and next unless -e $setup_file ;
32+ $self -> { WARN }( " Initializing with '$setup_file '\n " ) if $self -> {DISPLAY_SETUP_INFORMATION } ;
33+ $self -> { WARN }( " Asciio: Warning: can't find setup data '$setup_file '\n " ) and next unless -e $setup_file ;
2634
2735 push @{$self -> {SETUP_PATHS }}, $setup_file ;
2836
@@ -39,15 +47,14 @@ for my $setup_file (@{$setup_ini_files})
3947 CODE_FROM_FILE => $setup_file ,
4048 ) ;
4149
42- warn " can't load '$setup_file ': $! $@ \n " if $@ ;
50+ $self -> { WARN }( " can't load '$setup_file ': $! $@ \n " ) if $@ ;
4351 }
4452
4553 $self -> setup_object_options($setup_path , $ini_files -> {ASCIIO_OBJECT_SETUP } || []) ;
4654 if (defined $object_overrides )
4755 {
4856 while ( my ($k , $v ) = each $object_overrides -> %* )
4957 {
50- # print "object override $k -> $v\n" ;
5158 $self -> {$k } = $v ;
5259 }
5360 }
@@ -71,25 +78,25 @@ for my $stencil (@{$stencils})
7178 {
7279 if (-f " $setup_path /$stencil " )
7380 {
74- print STDERR " loading stencil '$setup_path /$stencil '\n " if $self -> {DISPLAY_SETUP_INFORMATION } ;
81+ $self -> { WARN }( " loading stencil '$setup_path /$stencil '\n " ) if $self -> {DISPLAY_SETUP_INFORMATION } ;
7582 $self -> load_elements(" $setup_path /$stencil " , $stencil ) ;
7683 }
7784 elsif (-d " $setup_path /$stencil " )
7885 {
7986 for (glob (" $setup_path /$stencil /*" ))
8087 {
81- print STDERR " batch loading stencil '$setup_path /$stencil /$_ '\n " if $self -> {DISPLAY_SETUP_INFORMATION } ;
88+ $self -> { WARN }( " batch loading stencil '$setup_path /$stencil /$_ '\n " ) if $self -> {DISPLAY_SETUP_INFORMATION } ;
8289 $self -> load_elements($_ , $stencil ) ;
8390 }
8491 }
8592 else
8693 {
87- print STDERR " Unknown type '$setup_path /$stencil '!\n " ;
94+ $self -> { WARN }( " Unknown type '$setup_path /$stencil '!\n " ) ;
8895 }
8996 }
9097 else
9198 {
92- print STDERR " Can't find '$setup_path /$stencil '!\n " ;
99+ $self -> { WARN }( " Can't find '$setup_path /$stencil '!\n " ) ;
93100 }
94101 }
95102}
@@ -180,7 +187,7 @@ for my $action_file (@{ $action_files })
180187 if (' HASH' eq ref $action_handler_definition )
181188 {
182189 $shortcuts_definition = $action_handler_definition -> {SHORTCUTS } ;
183- # print STDERR "\e[31maction_handler: '$name' is group $shortcuts_definition\e[m\n" ;
190+ # $self->{ACTION_VERBOSE}( "\e[31maction_handler: '$name' is group $shortcuts_definition\e[m\n") ;
184191
185192 $action_handler = $self -> get_group_action_handler($setup_path , $action_file , $name , $action_handler_definition ) ;
186193 }
@@ -200,7 +207,7 @@ for my $action_file (@{ $action_files })
200207 }
201208 else
202209 {
203- # print STDERR "ignoring '$name'\n" ;
210+ # $self->{ACTION_VERBOSE}( "ignoring '$name'\n") ;
204211 next ;
205212 }
206213
@@ -258,16 +265,16 @@ for my $action_file (@{ $action_files })
258265 {
259266 if (exists $self -> {ACTIONS }{$shortcut })
260267 {
261- print STDERR " Overriding shortcut '$shortcut '\n " ;
262- print STDERR " \t new is '$name ' defined in file '$setup_path /$action_file '\n " ;
263- print STDERR " \t old was '$self ->{ACTIONS}{$shortcut }{NAME}' defined in file '$self ->{ACTIONS}{$shortcut }{ORIGIN}'\n " ;
268+ $self -> { ACTION_VERBOSE }( " Overriding shortcut '$shortcut '\n " ) ;
269+ $self -> { ACTION_VERBOSE }( " \t new is '$name ' defined in file '$setup_path /$action_file '\n " ) ;
270+ $self -> { ACTION_VERBOSE }( " \t old was '$self ->{ACTIONS}{$shortcut }{NAME}' defined in file '$self ->{ACTIONS}{$shortcut }{ORIGIN}'\n " ) ;
264271 }
265272
266273 $self -> {ACTIONS }{$shortcut } = $action_handler ;
267274
268275 if (! defined $action_handler -> {CODE } && ! defined $action_handler -> {CONTEXT_MENU_SUB })
269276 {
270- print STDERR " \e [33mNo action for action_handler: '$name ', file: '$setup_path /$action_file '\e [m\n " ;
277+ $self -> { ACTION_VERBOSE }( " \e [33mNo action for action_handler: '$name ', file: '$setup_path /$action_file '\e [m\n " ) ;
271278 delete $self -> {ACTIONS }{$shortcut } ;
272279 }
273280
@@ -330,7 +337,7 @@ my $name = $action_handler->{NAME} ;
330337if (exists $self -> {ACTIONS_BY_NAME }{$name })
331338 {
332339 my $reused = ' ' ;
333- print STDERR " \e [33mOverriding action: '$name ', file: '$action_file ', old_file: '" . ($self -> {ACTIONS_BY_NAME }{ORIGINS }{$name }{ORIGIN } // ' unknown' )
340+ $self -> { ACTION_VERBOSE }( " \e [33mOverriding action: '$name ', file: '$action_file ', old_file: '" . ($self -> {ACTIONS_BY_NAME }{ORIGINS }{$name }{ORIGIN } // ' unknown' ) )
334341 if $self -> {DISPLAY_SETUP_ACTION_INFORMATION } ;
335342
336343 my $old_handler = $self -> {ACTIONS_BY_NAME }{$name } ;
@@ -364,7 +371,7 @@ if(exists $self->{ACTIONS_BY_NAME}{$name})
364371 $action_handler -> {CONTEXT_MENU_ARGUMENTS } = $old_handler -> {CONTEXT_MENU_ARGUMENTS } ;
365372 }
366373
367- print STDERR " $reused \e [m\n " ;
374+ $self -> { ACTION_VERBOSE }( " $reused \e [m\n " ) ;
368375 }
369376}
370377
@@ -421,10 +428,10 @@ for my $name (grep { $_ ne 'SHORTCUTS' && $_ ne 'ESCAPE_KEYS' } keys %{$group_de
421428
422429 for my $shortcut (' ARRAY' eq ref $shortcuts_definition ? @$shortcuts_definition : ($shortcuts_definition ))
423430 {
424- print STDERR " Overriding action group '$shortcut ' with definition from file '$setup_path /$action_file '!\n "
431+ $self -> { ACTION_VERBOSE }( " Overriding action group '$shortcut ' with definition from file '$setup_path /$action_file '!\n " )
425432 if exists $handler {$shortcut } && $self -> {DISPLAY_SETUP_ACTION_INFORMATION } ;
426433
427- # print STDERR "\e[32maction_handler: '$name' shortcut: $shortcut\e[m\n" ;
434+ # $self->{ACTION_VERBOSE}( "\e[32maction_handler: '$name' shortcut: $shortcut\e[m\n") ;
428435 $handler {$shortcut } = $action_handler ;
429436
430437 $handler {$shortcut }{GROUP_NAME } = $group_name if defined $group_name ;
474481 {
475482 if (exists $self -> {IMPORT_EXPORT_HANDLERS }{$extension })
476483 {
477- print STDERR " Overriding import/export handler for extension '$extension ' in file '$setup_path /$import_export_file '\n " ;
484+ $self -> { WARN }( " Overriding import/export handler for extension '$extension ' in file '$setup_path /$import_export_file '\n " ) ;
478485 }
479486
480487 $self -> {IMPORT_EXPORT_HANDLERS }{$extension } = $import_export_handlers {$extension } ;
0 commit comments