line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::GMOD::Util::Rearrange; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
39224
|
use strict; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
658
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
15
|
|
|
15
|
|
87
|
use vars qw(@ISA @EXPORT @EXPORT_OK); |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
6686
|
|
7
|
|
|
|
|
|
|
@ISA = 'Exporter'; |
8
|
|
|
|
|
|
|
@EXPORT_OK = qw(rearrange); |
9
|
|
|
|
|
|
|
@EXPORT = qw(rearrange); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# default export |
12
|
|
|
|
|
|
|
sub rearrange { |
13
|
6
|
|
|
6
|
0
|
43
|
my($order,@param) = @_; |
14
|
6
|
50
|
|
|
|
22
|
return unless @param; |
15
|
6
|
|
|
|
|
10
|
my %param; |
16
|
|
|
|
|
|
|
|
17
|
6
|
50
|
|
|
|
29
|
if (ref $param[0] eq 'HASH') { |
18
|
0
|
|
|
|
|
0
|
%param = %{$param[0]}; |
|
0
|
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
} else { |
20
|
|
|
|
|
|
|
# Named parameter must begin with hyphen |
21
|
6
|
50
|
33
|
|
|
64
|
return @param unless (defined($param[0]) && substr($param[0],0,1) eq '-'); |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
11
|
my $i; |
24
|
6
|
|
|
|
|
24
|
for ($i=0;$i<@param;$i+=2) { |
25
|
14
|
|
|
|
|
55
|
$param[$i]=~s/^\-//; # get rid of initial - if present |
26
|
14
|
|
|
|
|
48
|
$param[$i]=~tr/a-z/A-Z/; # parameters are upper case |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
6
|
|
|
|
|
29
|
%param = @param; # convert into associative array |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
10
|
my(@return_array); |
33
|
|
|
|
|
|
|
|
34
|
6
|
|
|
|
|
31
|
local($^W) = 0; |
35
|
6
|
|
|
|
|
14
|
my($key)=''; |
36
|
6
|
|
|
|
|
14
|
foreach $key (@$order) { |
37
|
21
|
|
|
|
|
27
|
my($value); |
38
|
21
|
50
|
|
|
|
39
|
if (ref($key) eq 'ARRAY') { |
39
|
0
|
|
|
|
|
0
|
foreach (@$key) { |
40
|
0
|
0
|
|
|
|
0
|
last if defined($value); |
41
|
0
|
|
|
|
|
0
|
$value = $param{$_}; |
42
|
0
|
|
|
|
|
0
|
delete $param{$_}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} else { |
45
|
21
|
|
|
|
|
36
|
$value = $param{$key}; |
46
|
21
|
|
|
|
|
37
|
delete $param{$key}; |
47
|
|
|
|
|
|
|
} |
48
|
21
|
|
|
|
|
102
|
push(@return_array,$value); |
49
|
|
|
|
|
|
|
} |
50
|
6
|
100
|
|
|
|
23
|
push (@return_array,{%param}) if %param; |
51
|
6
|
|
|
|
|
41
|
return @return_array; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |