.*?(.*?)<\/TR>.*?<\/tbody>/si) {
|
37
|
0
|
|
|
|
|
0
|
@list = $self->stocklist_parse($1); |
|
38
|
0
|
0
|
|
|
|
0
|
return undef unless @list; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
else { |
|
41
|
0
|
|
|
|
|
0
|
return undef; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
0
|
0
|
|
|
|
0
|
if ($list[11] !~ /$stockname/i) { |
|
44
|
0
|
|
|
|
|
0
|
return undef; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
0
|
|
|
|
|
0
|
return @list; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub stocklist_parse { |
|
50
|
0
|
|
|
0
|
0
|
0
|
shift; |
|
51
|
0
|
|
0
|
|
|
0
|
my $table = shift || die "no table sent to table-parser"; |
|
52
|
0
|
|
|
|
|
0
|
my @tds =(); |
|
53
|
0
|
|
|
|
|
0
|
my @retarr; |
|
54
|
|
|
|
|
|
|
my $shortname; |
|
55
|
0
|
0
|
|
|
|
0
|
if ($table =~ / | (.*?)<\/TD>(.*)/si) { |
|
56
|
0
|
|
|
|
|
0
|
$retarr[0] = $1; |
|
57
|
0
|
|
|
|
|
0
|
$table = $3; |
|
58
|
0
|
0
|
|
|
|
0
|
if ($2 =~ /(.*?)<\/nobr>/i) { |
|
59
|
0
|
|
|
|
|
0
|
$shortname = $1; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
0
|
die "Couldn't get shortname"; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
else { |
|
66
|
0
|
|
|
|
|
0
|
die "couldn't get company name"; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
foreach ($table =~ / | (.*?)<\/TD>/gsi) {
|
70
|
0
|
|
|
|
|
0
|
push @tds, $_; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
0
|
if (scalar(@tds) != 12) { |
|
74
|
0
|
|
|
|
|
0
|
die "wrong number of fields"; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
0
|
foreach (1 .. 2) { |
|
77
|
0
|
0
|
|
|
|
0
|
if ($tds[$_] =~ /(.*?)<\/FONT>/i) { |
|
78
|
0
|
|
|
|
|
0
|
$retarr[$_] = $1; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
else { |
|
82
|
0
|
|
|
|
|
0
|
$retarr[$_] = $tds[$_]; #Bättre än inget |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
0
|
foreach (3..7) { |
|
87
|
0
|
|
|
|
|
0
|
$retarr[$_] = $tds[$_]; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
foreach(8..9) { |
|
91
|
0
|
0
|
|
|
|
0
|
if ($tds[$_] =~ /(.*?)<\/nobr>/i) { |
|
92
|
0
|
|
|
|
|
0
|
$retarr[$_] = $1; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
else { |
|
95
|
0
|
|
|
|
|
0
|
$retarr[$_] = $tds[$_]; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
0
|
|
|
|
|
0
|
$retarr[10] = $tds[11]; |
|
99
|
0
|
|
|
|
|
0
|
$retarr[11] = $shortname; |
|
100
|
0
|
|
|
|
|
0
|
return @retarr; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub get_stocklist { |
|
104
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
|
105
|
1
|
|
|
|
|
2
|
my $stocklist = shift; |
|
106
|
1
|
50
|
|
|
|
5
|
if (!defined($stocklist)) { #can be zero |
|
107
|
0
|
|
|
|
|
0
|
die "get_stocklist() needs a list number"; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
1
|
|
|
|
|
2
|
my $list; |
|
110
|
1
|
|
|
|
|
1
|
my (@retlist, @trlist); |
|
111
|
|
|
|
|
|
|
|
|
112
|
1
|
50
|
|
|
|
7
|
die "get_stocklist() takes numerical list number" unless ($stocklist =~ /^\d+$/); |
|
113
|
1
|
50
|
|
|
|
6
|
if ($stocklist == 0) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
9
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE1&group=Kursnoteringar&listname=A-lista%20samtliga"; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
elsif ($stocklist == 1) { |
|
117
|
0
|
|
|
|
|
0
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE2&group=Kursnoteringar&listname=A-lista%20mest%20omsatta"; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
elsif ($stocklist == 2) { |
|
120
|
0
|
|
|
|
|
0
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE3&group=Kursnoteringar&listname=A-lista%20%C3%B6vriga"; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
elsif ($stocklist == 3) { |
|
123
|
0
|
|
|
|
|
0
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE43&group=Kursnoteringar&listname=O-lista%20samtliga"; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
elsif ($stocklist == 4) { |
|
126
|
0
|
|
|
|
|
0
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE10&group=Kursnoteringar&listname=O-lista%20mest%20Attract40"; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
elsif ($stocklist == 5) { |
|
129
|
0
|
|
|
|
|
0
|
$list = get "http://www.se.omxgroup.com/stocklist.aspx?list=SSE42&group=Kursnoteringar&listname=O-lista%20%EF%BF%BDvriga"; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
else { |
|
132
|
0
|
|
|
|
|
0
|
die "get_stocklist() takes a numerical argument of 0-5"; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
1
|
50
|
|
|
|
396043
|
if ($list =~ / |