-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpf_test.pl
More file actions
executable file
·51 lines (39 loc) · 1.41 KB
/
pf_test.pl
File metadata and controls
executable file
·51 lines (39 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /usr/bin/env perl
# - by Mark
#
# Thsi is an example of how to manipulate pf files
# using the perl implementation of the pf functions
#
# Specific values can be read from the pf file
# and written to the pf ojbject ("foo")
#
# You can also read (and write) values straight from the
# hash/array structure, but it's probably not worth it, and
# it's more confusing... EVERYTHING (tables, arrays) is
# returned as a reference, so you have to de-reference to access...
#
# Similarly, you have to pass a reference to 'pfput' to add/change
# an array or table, single values are just treated as scalars...
use lib "$ENV{ANTELOPE}/data/perl/";
use Datascope;
$pffile = $ARGV[0];
#@myarray = (1,2,3,4,5);
#$mine = \@myarray;
$mine = [1,2,3,4,5];
$pf_value = "confidence_level";
# get the whole pf file, by specifying no key...
$pfhash = pfget($pffile,"");
# create a new perl pf object, and put all of the values from the pf file in it...
$foo = pfnew("newpf");
foreach $key (keys %$pfhash) {
pfput($key,$$pfhash{$key},$foo);
}
print "$pf_value is: $$pfhash{$pf_value} \n";
# can do useful things, like generate your own arrival tables
# from a db in a loop, and run command line locations with
# each new file...
# here I'm just pulling it from the file... can generate your own
$arrival_table = pfget($pffile,"arrival_table");
pfput("arrival_table",$arrival_table,$foo);
pfput("my_table",$mine,$foo);
pfwrite("newdbloc.pf", $foo);