Changeset 55
- Timestamp:
- Jul 24, 2009, 1:35:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r54 r55 165 165 166 166 # my $cmdarping = `arping -c 1 -w 1 -rR $param 2>/dev/null`; 167 if ( not $param_ip_or_host =~ m/^\d+ \. \d+ \. \d+ \. \d+$/x ) {168 $param_ip_or_host =~ s/ \. .* //x ;167 if ( not $param_ip_or_host =~ m/^\d+ \. \d+ \. \d+ \. \d+$/xms ) { 168 $param_ip_or_host =~ s/ \. .* //xms; 169 169 } 170 170 … … 216 216 #$ret{hostname_fq} = $param_ip_or_host if not defined $1 and $ret{hostname_fq} eq 'unknow'; 217 217 218 unless ($ret{mac_address} eq'unknow') {218 if ($ret{mac_address} ne 'unknow') { 219 219 my @paquets = (); 220 foreach ( split m/ : /x , $ret{mac_address} ) {220 foreach ( split m/ : /xms, $ret{mac_address} ) { 221 221 my @chars = split m//xms, uc("00$_"); 222 222 push @paquets, "$chars[-2]$chars[-1]"; … … 233 233 234 234 for my $sw_kind (keys %SWITCH_KIND) { 235 next if not $sw_snmp_description =~ m/$SWITCH_KIND{$sw_kind}->{match}/x ;235 next if not $sw_snmp_description =~ m/$SWITCH_KIND{$sw_kind}->{match}/xms; 236 236 237 237 return $SWITCH_KIND{$sw_kind}->{model}; … … 445 445 my @line = @{$KLASK_CFG->{network}{$net}{'ip-subnet'}}; 446 446 for my $cmd (@line) { 447 for my $method (keys % $cmd){447 for my $method (keys %{$cmd}){ 448 448 $cidrlist->add_any($cmd->{$method}) if $method eq 'add'; 449 449 } … … 455 455 for my $cidr ($cidrlist->list()) { 456 456 my $net = new NetAddr::IP $cidr; 457 for my $ip (@ $net) {458 $ip =~ s{ /32 }{}x ;457 for my $ip (@{$net}) { 458 $ip =~ s{ /32 }{}xms; 459 459 push @res, $ip; 460 460 } … … 599 599 600 600 my $number_of_computer = get_list_ip(@network); # + 1; 601 my $size_of_database = keys % $computerdb;601 my $size_of_database = keys %{$computerdb}; 602 602 $size_of_database = 1 if $size_of_database == 0; 603 603 my $i = 0; … … 747 747 748 748 my $dirdb = $KLASK_DB_FILE; 749 $dirdb =~ s{ / [^/]* $}{}x ;749 $dirdb =~ s{ / [^/]* $}{}xms; 750 750 mkdir "$dirdb", 0755 unless -d "$dirdb"; 751 751 YAML::Syck::DumpFile("$KLASK_DB_FILE", $computerdb); … … 775 775 776 776 my $dirdb = $KLASK_DB_FILE; 777 $dirdb =~ s{ / [^/]* $}{}x ;777 $dirdb =~ s{ / [^/]* $}{}xms; 778 778 mkdir "$dirdb", 0755 unless -d "$dirdb"; 779 779 YAML::Syck::DumpFile("$KLASK_DB_FILE", $computerdb); … … 810 810 811 811 LOOP_ON_IP_ADDRESS: 812 foreach my $ip (Net::Netmask::sort_by_ip_address(keys % $computerdb)) {812 foreach my $ip (Net::Netmask::sort_by_ip_address(keys %{$computerdb})) { 813 813 814 814 # next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{hostname_fq} eq 'unknow'; … … 874 874 my %mac_count = (); 875 875 LOOP_ON_IP_ADDRESS: 876 foreach my $ip (keys % $computerdb) {876 foreach my $ip (keys %{$computerdb}) { 877 877 878 878 # to be improve in the future … … 885 885 886 886 LOOP_ON_IP_ADDRESS: 887 foreach my $ip (Net::Netmask::sort_by_ip_address(keys % $computerdb)) {887 foreach my $ip (Net::Netmask::sort_by_ip_address(keys %{$computerdb})) { 888 888 889 889 # to be improve in the future … … 907 907 my $mac_sort = sprintf "%04i-%s", 9999 - $mac_count{$computerdb->{$ip}{mac_address}}, $computerdb->{$ip}{mac_address}; 908 908 909 $computerdb->{$ip}{hostname_fq} = 'unknow' if $computerdb->{$ip}{hostname_fq} =~ m/^ \d+ \. \d+ \. \d+ \. \d+ $/x ;909 $computerdb->{$ip}{hostname_fq} = 'unknow' if $computerdb->{$ip}{hostname_fq} =~ m/^ \d+ \. \d+ \. \d+ \. \d+ $/xms; 910 910 my ( $host_short ) = split m/ \. /xms, $computerdb->{$ip}{hostname_fq}; 911 911 … … 1044 1044 1045 1045 LOOP_ON_IP_ADDRESS: 1046 foreach my $ip (Net::Netmask::sort_by_ip_address(keys % $computerdb)) {1046 foreach my $ip (Net::Netmask::sort_by_ip_address(keys %{$computerdb})) { 1047 1047 1048 1048 next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{hostname_fq} eq ($computerdb->{$ip}{switch_hostname} || $computerdb->{$ip}{switch_description}); # switch on himself !
Note: See TracChangeset
for help on using the changeset viewer.