Changeset 312


Ignore:
Timestamp:
Oct 21, 2017, 6:59:05 PM (7 years ago)
Author:
g7moreau
Message:
  • Clean code and change arrow
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r311 r312  
    28542854   my %db_switch_connected_on_port = %{$switch_connection->{'connected_on_port'}};
    28552855
     2856   # Switch output port and parent port connection
    28562857   my $tb_child = Text::Table->new( # http://www.perlmonks.org/?node_id=988320
    28572858      {align => 'left',   align_title => 'left',   title => 'Child_Switch'},
     
    28612862      {align => 'left',   align_title => 'left',   title => 'Parent_Switch'},
    28622863      );
    2863    #print "Switch output port and parent port connection\n";
    2864    #print "---------------------------------------------\n";
    28652864   for my $sw (sort keys %db_switch_output_port) {
    28662865      my $arrow ='--->';
    28672866         $arrow ='===>' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/;
    28682867      if (exists $db_switch_parent{$sw}) {
    2869          #printf "%-28s %8s %3s %-8s %-25s\n", $sw, $db_switch_output_port{$sw}, $arrow, $db_switch_parent{$sw}->{'port_hr'}, $db_switch_parent{$sw}->{'switch'};
    28702868         $tb_child->add($sw, $db_switch_output_port{$sw}, $arrow, $db_switch_parent{$sw}->{'port_hr'}, $db_switch_parent{$sw}->{'switch'});
    28712869
    28722870         }
    28732871      else {
    2874          #printf "%-28s %8s %3s %-8s %-25s\n", $sw, $db_switch_output_port{$sw}, $arrow, '', 'router';
    28752872         $tb_child->add($sw, $db_switch_output_port{$sw}, $arrow, '', 'router');
    28762873         }
    28772874      }
    28782875   my @colrange = map { scalar $tb_child->colrange($_) } (0 .. 4); # force scaler context
    2879    $tb_child->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table
     2876   $tb_child->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output
    28802877   print $tb_child->title();
    28812878   print $tb_child->rule('-');
     
    28832880   $tb_child->clear;
    28842881
     2882   # Switch parent and children port inter-connection
    28852883   print "\n";
    28862884   my $tb_parent = Text::Table->new( # http://www.perlmonks.org/?node_id=988320
     
    28912889      {align => 'left',   align_title => 'left',   title => 'Child_Switch'},
    28922890      );
    2893    #print "Switch parent and children port inter-connection\n";
    2894    #print "------------------------------------------------\n";
    28952891   for my $swport (sort keys %db_switch_connected_on_port) {
    28962892      my ($sw_connect, $port_connect) = split m/ $SEP_SWITCH_PORT /xms, $swport, 2;
    28972893      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    2898          my $arrow ='<--';
    2899             $arrow ='<==' if $port_connect =~ m/^(Trk|Br|Po)/;
     2894         my $arrow ='<---';
     2895            $arrow ='<===' if $port_connect =~ m/^(Trk|Br|Po)/;
    29002896         if (exists $db_switch_output_port{$sw}) {
    2901             #printf "%-28s %8s %3s %-8s %-25s\n", $sw_connect, $port_connect, $arrow, $db_switch_output_port{$sw}, $sw;
    29022897            $tb_parent->add($sw_connect, $port_connect, $arrow, $db_switch_output_port{$sw}, $sw);
    29032898            }
    29042899         else {
    2905             #printf "%-28s %8s %3s %-8s %-25s\n", $sw_connect, $port_connect, $arrow, '', $sw;
    29062900            $tb_parent->add($sw_connect, $port_connect, $arrow, '', $sw);
    29072901            }
     
    29092903      }
    29102904   @colrange = map { scalar $tb_parent->colrange($_) } (0 .. 4); # force scaler context
    2911    $tb_parent->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table
     2905   $tb_parent->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output
    29122906   print $tb_parent->title();
    29132907   print $tb_parent->rule('-');
Note: See TracChangeset for help on using the changeset viewer.