author | victorp@symbian.org |
Fri, 31 Jul 2009 11:01:24 +0100 | |
changeset 22 | dbe87093a3ca |
child 23 | 8fb98cf0b1ac |
permissions | -rw-r--r-- |
22
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
2 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
3 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
4 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
5 |
use IO::Socket; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
6 |
use Getopt::Long; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
7 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
8 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
9 |
my $target_url; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
10 |
my $tdomain; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
11 |
my $csvfile; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
12 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
13 |
sub getpage |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
14 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
15 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
16 |
($page,$host,$auth,$myfile)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
17 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
18 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
19 |
#output file |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
20 |
open ( outputfile, ">".$myfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
21 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
22 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
23 |
$port = "http(80)"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
24 |
$getmess = "GET " . $page ." HTTP/1.1\n" . $auth; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
25 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
26 |
print "sending message - $getmess\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
27 |
print outputfile "$getmess\n\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
28 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
29 |
$sock = IO::Socket::INET->new |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
30 |
( |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
31 |
PeerAddr => $host, PeerPort => $port, Proto => 'tcp', |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
32 |
) ; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
33 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
34 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
35 |
print $sock "$getmess\n\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
36 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
37 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
38 |
while(<$sock>) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
39 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
40 |
print outputfile $_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
41 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
42 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
43 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
44 |
close ($sock); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
45 |
close (outputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
46 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
47 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
48 |
sub prntfeatures |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
49 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
50 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
51 |
($release,$package,$features,$myfile,$domain)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
52 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
53 |
$features = $features."<dt"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
54 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
55 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
56 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
57 |
while ( $features =~ /dt\>(.*?)\<\/dt(.*?)\<dt/sg ){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
58 |
$myfeat = $1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
59 |
$subfeat =$2; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
60 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
61 |
$myfeat =~ s/\n/ /sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
62 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
63 |
pos($features) = pos($features) -2; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
64 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
65 |
$mystr=""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
66 |
while ( $subfeat =~ /\<dd\>(.*?)\<\/dd\>/sg) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
67 |
$mysubfeat = $mysubfeat.$mystr.$1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
68 |
$mystr = " & "; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
69 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
70 |
undef $mystr; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
71 |
$mysubfeat =~ s/,/ /sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
72 |
$mysubfeat =~ s/\n//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
73 |
$mysubfeat =~ s/\<.*?\>//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
74 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
75 |
$release =~ s/\\//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
76 |
print $myfile " $release, $domain, $package, $myfeat, $mysubfeat\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
77 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
78 |
$mysubfeat = ""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
79 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
80 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
81 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
82 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
83 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
84 |
sub loadfile |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
85 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
86 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
87 |
$/ = " "; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
88 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
89 |
($myfile)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
90 |
open ( inputfile, "<".$myfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
91 |
my $contents = do { local $/; <inputfile> }; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
92 |
close(inputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
93 |
return $contents; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
94 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
95 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
96 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
97 |
sub td_roadmap |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
98 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
99 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
100 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
101 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
102 |
($infile,$outfile,$domain,@releases)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
103 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
104 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
105 |
$roadmap=loadfile $infile; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
106 |
open ( outputfile, ">>".$outfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
107 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
108 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
109 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
110 |
foreach (@releases) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
111 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
112 |
$exp="\\<h2\\>.*?\\>".$_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
113 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
114 |
if ($roadmap =~ m /($exp)/sg) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
115 |
print "Found entry for $_ \n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
116 |
$relroad =$'; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
117 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
118 |
if ($relroad =~ m /(.*?)\<h2/sg) { $relroad =$1;} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
119 |
$i=0; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
120 |
while ($relroad=~ m/\<h3\>.*\>(.*?)\<.*<\/h3/g) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
121 |
$package = $1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
122 |
$ppos[$i]= pos($relroad); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
123 |
$pname[$i]= $package; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
124 |
$i++; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
125 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
126 |
for ( $i=0;$i<($#ppos); $i++){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
127 |
$features= substr ($relroad, $ppos[$i],$ppos[$i+1]-$ppos[$i]); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
128 |
prntfeatures($_,$pname[$i],$features,outputfile,$domain); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
129 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
130 |
$features= substr ($relroad, $ppos[$i]); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
131 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
132 |
prntfeatures($_,$pname[$i],$features,outputfile,$domain); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
133 |
@ppos =""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
134 |
@pname =""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
135 |
undef ($features); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
136 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
137 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
138 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
139 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
140 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
141 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
142 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
143 |
close (outputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
144 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
145 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
146 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
147 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
148 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
149 |
#help print |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
150 |
sub printhelp |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
151 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
152 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
153 |
print "\n\n version 0.2 |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
154 |
\ngettd.pl -t=url -d=domain \nrequired parameters:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
155 |
\n Optional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
156 |
exit; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
157 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
158 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
159 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
160 |
#process command line options |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
161 |
sub cmd_options |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
162 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
163 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
164 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
165 |
my $help; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
166 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
167 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
168 |
GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
169 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
170 |
if ($help) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
171 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
172 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
173 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
174 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
175 |
if ( not $target_url) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
176 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
177 |
print "ERROR-missing arguments target url\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
178 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
179 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
180 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
181 |
if (not $tdomain){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
182 |
print "ERROR-missing arguments domain level\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
183 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
184 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
185 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
186 |
print "\nINFO-downloading $target_url with label $tdomain\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
187 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
188 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
189 |
if (not $csvfile) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
190 |
$csvfile="output.csv"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
191 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
192 |
print "\nINFO-output recorded in $csvfile \n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
193 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
194 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
195 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
196 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
197 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
198 |
#main |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
199 |
$/ = " "; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
200 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
201 |
#file containing login details from http cookie |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
202 |
$mycookie = loadfile("mycookie.txt"); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
203 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
204 |
#$auth ="Authorization: Basic Zm91bmRhdGlvbjp0ZXN0MA=="; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
205 |
$auth = "Cookie: " . $mycookie ; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
206 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
207 |
#foundation releases - add as required |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
208 |
@releases=("Symbian\\^2","Symbian\\^3","Symbian\\^4"); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
209 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
210 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
211 |
$host1 = "developer.symbian.org"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
212 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
213 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
214 |
cmd_options(); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
215 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
216 |
getpage($target_url, $host1, $auth, "debug.txt"); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
217 |
td_roadmap("debug.txt" , $csvfile, $tdomain ,@releases); |