github.com/shyftnetwork/go-empyrean@v1.8.3-0.20191127201940-fbfca9338f04/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl (about) 1 #!/usr/bin/perl 2 3 use JSON; 4 5 my $f; 6 my $jsontext; 7 my $nodelist; 8 my $network; 9 10 open($f, "<", $ARGV[0]) || die "cant open " . $ARGV[0]; 11 while (<$f>) { 12 $jsontext .= $_; 13 } 14 close($f); 15 16 $network = decode_json($jsontext); 17 $nodelist = $network->{'nodes'}; 18 19 for ($i = 0; $i < 0+@$nodelist; $i++) { 20 #my $protocollist = $$nodelist[$i]{'node'}{'info'}{'protocols'}; 21 #$$protocollist{'pss'} = "pss"; 22 my $svc = $$nodelist[$i]{'node'}{'config'}{'services'}; 23 pop(@$svc); 24 push(@$svc, "pss"); 25 push(@$svc, "bzz"); 26 } 27 28 print encode_json($network);