| 1 | # Copyright 2004 by Audrey Tang <cpan@audreyt.org> | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Win32::Exe::Section::Resources; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use base 'Win32::Exe::Section'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use constant DELEGATE_SUBS => ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 'ResourceEntry' => [ 'high_bit' ], | ||||||||||||||||||||||||||||
| 9 | 'ResourceEntry::Id' => [ 'rt_to_id', 'id_to_rt' ], | ||||||||||||||||||||||||||||
| 10 | 5 | ); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 8 | ▶ | sub initialize { | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 14 | 8 | $self->make_table(0); | |||||||||||||||||||||||||||
| 15 | 8 | return $self; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub table { | ||||||||||||||||||||||||||
|
Subroutine
table: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 20 | 0 | return $self->{table}; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 80 | ▶ | sub make_table { | ||||||||||||||||||||||||||
|
Subroutine
make_table: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 80 | my ($self, $offset, @path) = @_; | |||||||||||||||||||||||||||
| 25 | 80 | my $image = $self->substr($offset); | |||||||||||||||||||||||||||
| 26 | 80 | my $table = $self->require_class('ResourceTable')->new( | |||||||||||||||||||||||||||
| 27 | \$image, { | ||||||||||||||||||||||||||||
| 28 | parent => $self, | ||||||||||||||||||||||||||||
| 29 | path => \@path | ||||||||||||||||||||||||||||
| 30 | }, | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 80 | foreach my $entry ($table->members) { | |||||||||||||||||||||||||||
| 34 | 112 | ▶ | if ($entry->IsDirectory) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 72 | $self->make_table($entry->VirtualAddress, @path, $entry->Name); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | else { | ||||||||||||||||||||||||||||
| 38 | 40 | $self->{table}{$entry->PathName} = $entry; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 80 | ▶ | sub names { | ||||||||||||||||||||||||||
|
Subroutine
names: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 80 | my ($self) = @_; | |||||||||||||||||||||||||||
| 45 | 80 | my @rv = sort keys %{$self->{table}}; | |||||||||||||||||||||||||||
| 46 | 80 | ▶ | wantarray ? @rv : \@rv; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 31 | ▶ | sub resources { | ||||||||||||||||||||||||||
|
Subroutine
resources: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 31 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 51 | 31 | my @rv = map $self->{table}{$_}, $self->names; | |||||||||||||||||||||||||||
| 52 | 31 | ▶ | wantarray ? @rv : \@rv; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 11 | ▶ | sub remove { | ||||||||||||||||||||||||||
|
Subroutine
remove: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 11 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 57 | 11 | delete $self->{table}{$_} for grep /^\Q$name\E/, $self->names; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 13 | ▶ | sub insert { | ||||||||||||||||||||||||||
|
Subroutine
insert: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 13 | my ($self, $name, $res) = @_; | |||||||||||||||||||||||||||
| 62 | 13 | $self->{table}{$name} = $res; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 137 | ▶ | sub res { | ||||||||||||||||||||||||||
|
Subroutine
res: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 137 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 67 | 137 | return $self->{table}{$name}; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 94 | ▶ | sub res_data { | ||||||||||||||||||||||||||
|
Subroutine
res_data: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | 94 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 72 | 94 | ▶ | my $res = $self->res($name) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 94 | return $res->Data; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 43 | ▶ | sub res_codepage { | ||||||||||||||||||||||||||
|
Subroutine
res_codepage: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 43 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 78 | 43 | ▶ | my $res = $self->res($name) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 43 | return $res->CodePage; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub res_object { | ||||||||||||||||||||||||||
|
Subroutine
res_object: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 84 | 0 | ▶ | my $res = $self->res($name) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 0 | return $res->object; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub res_image { | ||||||||||||||||||||||||||
|
Subroutine
res_image: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | my $res = $self->res($name) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $object = $res->object or return $res->Data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | return $object->dump; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 14 | ▶ | sub first_object { | ||||||||||||||||||||||||||
|
Subroutine
first_object: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 96 | 14 | my ($self, $type) = @_; | |||||||||||||||||||||||||||
| 97 | 14 | foreach my $object (grep $_, map $_->object, $self->resources) { | |||||||||||||||||||||||||||
| 98 | 24 | ▶ | return $object if !$type or $object->is_type($type); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $type or $object->is_type($type)
MC/DC50%1/2
not $type or $object->is_type($type)
not $type
$object->is_type($type)
Truth table66%2/3
not(A) or B
A= not $typeB= $object->is_type($type)
| |||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 0 | return undef; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 8 | ▶ | sub objects { | ||||||||||||||||||||||||||
|
Subroutine
objects: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | 8 | my ($self, $type) = @_; | |||||||||||||||||||||||||||
| 105 | 28 | ▶ | return grep { $type ? $_->is_type($type) : 1 } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 8 | grep { $_ } map { $_->object } $self->resources; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 9 | ▶ | sub refresh { | ||||||||||||||||||||||||||
|
Subroutine
refresh: called CC=9 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 110 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 9 | ▶ | my $res_num = @{$self->resources} or return pack('V*', (0) x 4); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 9 | my $entry_size = $self->entry_size(scalar $self->names); | |||||||||||||||||||||||||||
| 114 | 9 | my $data_entry_size = 16 * $res_num; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 9 | my %str_addr; | |||||||||||||||||||||||||||
| 117 | 9 | my $str_image = ''; | |||||||||||||||||||||||||||
| 118 | 9 | my $str_offset = $entry_size + $data_entry_size; | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 9 | foreach my $name ($self->names) { | |||||||||||||||||||||||||||
| 121 | 43 | $name =~ s!^/!!; | |||||||||||||||||||||||||||
| 122 | 43 | foreach my $chunk (split("/", $name, -1)) { | |||||||||||||||||||||||||||
| 123 | 129 | ▶ | $chunk =~ /^#/ and next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | $chunk =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; | |||||||||||||||||||||||||||
| 125 | 0 | ▶ | next if exists $str_addr{$chunk}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | die "String too long" if length($chunk) > 0xFFFF; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | my $addr = length($str_image); | |||||||||||||||||||||||||||
| 130 | 0 | my $str = $self->encode_ucs2($chunk); | |||||||||||||||||||||||||||
| 131 | 0 | $str_image .= pack('v', length($str) / 2) . $str; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | $str_addr{$chunk} = $addr + $str_offset; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | 9 | $str_image .= $self->pad($str_image, 8); | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 9 | my %data_entry_addr; | |||||||||||||||||||||||||||
| 139 | 9 | my $data_entry_image = ''; | |||||||||||||||||||||||||||
| 140 | 9 | my $data_image = ''; | |||||||||||||||||||||||||||
| 141 | 9 | my $data_offset = $str_offset + length($str_image); | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 9 | foreach my $name ($self->names) { | |||||||||||||||||||||||||||
| 144 | 43 | $data_entry_addr{$name} = $entry_size + length($data_entry_image); | |||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 43 | my $data_addr = $data_offset + length($data_image) + $self->VirtualAddress; | |||||||||||||||||||||||||||
| 147 | 43 | $data_entry_image .= pack( | |||||||||||||||||||||||||||
| 148 | 'V4', | ||||||||||||||||||||||||||||
| 149 | $data_addr, | ||||||||||||||||||||||||||||
| 150 | length($self->res_data($name)), | ||||||||||||||||||||||||||||
| 151 | $self->res_codepage($name), | ||||||||||||||||||||||||||||
| 152 | 0, | ||||||||||||||||||||||||||||
| 153 | ); | ||||||||||||||||||||||||||||
| 154 | 43 | $data_image .= $self->res_data($name); | |||||||||||||||||||||||||||
| 155 | 43 | $data_image .= $self->pad($data_image, 8); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 9 | my $entry_image = ''; | |||||||||||||||||||||||||||
| 159 | 9 | $self->make_entry( | |||||||||||||||||||||||||||
| 160 | \$entry_image, | ||||||||||||||||||||||||||||
| 161 | '', | ||||||||||||||||||||||||||||
| 162 | [$self->names], | ||||||||||||||||||||||||||||
| 163 | \%str_addr, | ||||||||||||||||||||||||||||
| 164 | \%data_entry_addr, | ||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 9 | ▶ | length($entry_image) == $entry_size or die "Wrong size"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 9 | $self->SetData( | |||||||||||||||||||||||||||
| 170 | join('', $entry_image, $data_entry_image, $str_image, $data_image) | ||||||||||||||||||||||||||||
| 171 | ); | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 131 | ▶ | sub entry_size { | ||||||||||||||||||||||||||
|
Subroutine
entry_size: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 175 | 131 | my ($self, $names) = @_; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 131 | my %entries; | |||||||||||||||||||||||||||
| 178 | 131 | foreach my $name (grep length, @$names) { | |||||||||||||||||||||||||||
| 179 | 129 | ▶ | $name =~ m!^/([^/]*)(.*)! or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 129 | push(@{ $entries{$1} }, $2); | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 131 | ▶ | my $count = keys %entries or return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 88 | my $size = 8 * ($count + 2); | |||||||||||||||||||||||||||
| 185 | 88 | $size += $self->entry_size($_) for values %entries; | |||||||||||||||||||||||||||
| 186 | 88 | return $size; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 131 | ▶ | sub make_entry { | ||||||||||||||||||||||||||
|
Subroutine
make_entry: called CC=8 SCAR=21.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 190 | 131 | my ($self, $image_ref, $prefix, $names, $str_addr, $data_entry_addr) = @_; | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 131 | ▶ | if (@$names == 1 and !length($names->[0])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$names == 1 and not length $names->[0]
MC/DC100%2/2
@$names == 1 and not length $names->[0]
@$names == 1
not length $names->[0]
Truth table100%3/3
A and not(B)
A= @$names == 1B= not length $names->[0]
| |||||||||||||||||||||||||||||
| 193 | 43 | return $data_entry_addr->{$prefix}; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 88 | my %entries; | |||||||||||||||||||||||||||
| 197 | 88 | foreach my $name (@$names) { | |||||||||||||||||||||||||||
| 198 | 129 | ▶ | $name =~ m!^/([^/]*)(.*)! or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 129 | my ($path, $name) = ($1, $2); | |||||||||||||||||||||||||||
| 200 | 129 | ▶ | my $type = ($path =~ /^#/) ? 'id' : 'name'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 129 | push(@{ $entries{$type}{$path} }, $name); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 88 | my $addr = length($$image_ref); | |||||||||||||||||||||||||||
| 205 | 88 | my $num_name = keys %{ $entries{name} }; | |||||||||||||||||||||||||||
| 206 | 88 | my $num_id = keys %{ $entries{id} }; | |||||||||||||||||||||||||||
| 207 | 88 | $$image_ref .= pack('V3vv', 0, 0, 0, $num_name, $num_id); | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 88 | my $entry_offset = length($$image_ref); | |||||||||||||||||||||||||||
| 210 | 88 | $$image_ref .= pack('V*', (0) x (($num_name + $num_id) * 2)); | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 88 | foreach my $entry ($self->sort_entry(\%entries)) { | |||||||||||||||||||||||||||
| 213 | 122 | my ($type, $name) = @$entry; | |||||||||||||||||||||||||||
| 214 | 122 | my $id; | |||||||||||||||||||||||||||
| 215 | 122 | ▶ | if ($type eq 'id') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 122 | $id = $name; | |||||||||||||||||||||||||||
| 217 | 122 | $id =~ s/^#//; | |||||||||||||||||||||||||||
| 218 | 122 | $id = $self->rt_to_id($id); | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||
| 221 | 0 | (my $n = $name) =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; | |||||||||||||||||||||||||||
| 222 | 0 | $id = $str_addr->{$n} | $self->high_bit; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | my $rva = $self->make_entry( | ||||||||||||||||||||||||||||
| 226 | $image_ref, | ||||||||||||||||||||||||||||
| 227 | "$prefix/$name", | ||||||||||||||||||||||||||||
| 228 | 122 | $entries{$type}{$name}, | |||||||||||||||||||||||||||
| 229 | $str_addr, | ||||||||||||||||||||||||||||
| 230 | $data_entry_addr, | ||||||||||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 122 | substr($$image_ref, $entry_offset, 8) = pack('VV', $id, $rva); | |||||||||||||||||||||||||||
| 234 | 122 | $entry_offset += 8; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 88 | return ($addr | $self->high_bit); | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 88 | ▶ | sub sort_entry { | ||||||||||||||||||||||||||
|
Subroutine
sort_entry: called CC=1 SCAR=0.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 241 | 88 | my ($self, $entries) = @_; | |||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 0 | my @names = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { | |||||||||||||||||||||||||||
| 244 | 0 | my $name = lc($_); | |||||||||||||||||||||||||||
| 245 | 0 | $name =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; | |||||||||||||||||||||||||||
| 246 | 0 | [ $name => $_ ]; | |||||||||||||||||||||||||||
| 247 | 88 | } keys %{ $entries->{name} }; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | my @ids = map "#$_", sort { | ||||||||||||||||||||||||||||
| 250 | 44 | $self->rt_to_id($a) <=> $self->rt_to_id($b) | |||||||||||||||||||||||||||
| 251 | 88 | } map substr($_, 1), keys %{ $entries->{id} }; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | return( | ||||||||||||||||||||||||||||
| 254 | 88 | (map [ name => $_ ], @names), | |||||||||||||||||||||||||||
| 255 | (map [ id => $_ ], @ids), | ||||||||||||||||||||||||||||
| 256 | ); | ||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 5 | 1; | |||||||||||||||||||||||||||