#!/usr/bin/perl # simtrafic.pl # # Simulates grafic for linkmap trafic attribute demonstration # $scriptname="simtrafic.pl"; $author ="Ous"; $versionstring="0.1"; $versiondate="7Jun07"; # # # License: WL # # History: # ver: date: Desc: # 0.1 5jun07 Initial attempt # # Todo: # # Known issues: # ======================================================================================== $linklist="./reduced_linklist.txt"; $outfile="./simtraf.txt"; #=======MAIN============ &init; $config_end=false; while($linkline=) { chomp($linkline); if ($linkline !~ /^#/) { ($linkid,$link) = split (/\t/,$linkline); $r=1+int rand 14; print "$link\t$r\n"; print OUTFILE "$link\t$r\n"; } } &close_all; #======================= #======================== sub init { $date=localtime; #print "$date\n"; ($dat_weekday, $dat_month, $dat_day, $dat_time, $dat_year)= split(/\s+/,$date); $lastchange="$dat_day $dat_month $dat_year"; open (LINKLIST,$linklist) or die "Can't open $linklist"; open (OUTFILE, ">$outfile"); print OUTFILE "# Simulated link trafic \n"; print OUTFILE "# Generated on $lastchange:$dat_time by $scriptname ver.$versionstring\n"; } #======================== #======================== sub close_all { close (LINKLIST); close(OUTFILE); } #======================= #========================