| 1 | ############################################################################# | ||||||||||||||||||||||||||||
| 2 | # Package Win32::Exe::Manifest | ||||||||||||||||||||||||||||
| 3 | # Description: Handle Win32 PE Manifests | ||||||||||||||||||||||||||||
| 4 | # Created Mon Apr 19 17:15:24 2010 | ||||||||||||||||||||||||||||
| 5 | # SVN Id $Id: Manifest.pm 2 2010-11-30 16:40:31Z mark.dootson $ | ||||||||||||||||||||||||||||
| 6 | # Copyright: Copyright (c) 2010 Mark Dootson | ||||||||||||||||||||||||||||
| 7 | # Licence: This program is free software; you can redistribute it | ||||||||||||||||||||||||||||
| 8 | # and/or modify it under the same terms as Perl itself | ||||||||||||||||||||||||||||
| 9 | ############################################################################# | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | package Win32::Exe::Manifest; | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | ############################################################################# | ||||||||||||||||||||||||||||
| 14 | # References | ||||||||||||||||||||||||||||
| 15 | # http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx | ||||||||||||||||||||||||||||
| 16 | # http://msdn.microsoft.com/en-us/library/aa374191(VS.85).aspx | ||||||||||||||||||||||||||||
| 17 | # http://msdn.microsoft.com/en-us/library/aa374219(v=VS.85).aspx | ||||||||||||||||||||||||||||
| 18 | # http://msdn.microsoft.com/en-us/library/aa376607(v=VS.85).aspx | ||||||||||||||||||||||||||||
| 19 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use Win32::Exe::Manifest::Parser; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 5 | ▶ | use base qw( Exporter ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 5 | our $VERSION = '0.15'; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 NAME | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | Win32::Exe::Manifest - MSWin Application and Assembly manifest handling | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 VERSION | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | This document describes version 0.15 of Win32::Exe::Manifest, released | ||||||||||||||||||||||||||||
| 37 | November 30, 2010. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | use Win32::Exe | ||||||||||||||||||||||||||||
| 42 | my $exe = Win32:::Exe->new('somefilepath'); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | my $manifest = $exe->get_manifest if $exe->has_manifest; | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # Get themed controls | ||||||||||||||||||||||||||||
| 47 | $manifest->add_common_controls; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # Change name | ||||||||||||||||||||||||||||
| 50 | $manifest->set_assembly_name('My.App.Name'); | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | # Require Admin permissions | ||||||||||||||||||||||||||||
| 53 | $manifest->set_execution_level('requireAdministrator'); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | # write it out | ||||||||||||||||||||||||||||
| 56 | $exe->set_manifest($manifest); | ||||||||||||||||||||||||||||
| 57 | $exe->write; | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | #roll your own | ||||||||||||||||||||||||||||
| 60 | use Win32::Exe::Manifest | ||||||||||||||||||||||||||||
| 61 | my $xml = $handmademanifest; | ||||||||||||||||||||||||||||
| 62 | ...... | ||||||||||||||||||||||||||||
| 63 | my $manifest = Win32::Exe::Manifest->new($xml, 'application'); | ||||||||||||||||||||||||||||
| 64 | $exe->set_manifest($manifest); | ||||||||||||||||||||||||||||
| 65 | $exe->write; | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | #get formated $xml | ||||||||||||||||||||||||||||
| 68 | my $xml = $manifest->output; | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | #try merge (experimental) | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | my $mfest1 = $exe->get_manifest; | ||||||||||||||||||||||||||||
| 73 | my $mfest2 = Win32::Exe::Manifest->new($xml, 'application'); | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | $mfest1->merge_manifest($mfest2); | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | $exe->set_manifest($mfest1); | ||||||||||||||||||||||||||||
| 78 | $exe->write; | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | #add a dependency | ||||||||||||||||||||||||||||
| 81 | my $info = | ||||||||||||||||||||||||||||
| 82 | { type => 'win32', | ||||||||||||||||||||||||||||
| 83 | name => 'Dependency.Prog.Id', | ||||||||||||||||||||||||||||
| 84 | version => 1.0.0.0, | ||||||||||||||||||||||||||||
| 85 | language => '*', | ||||||||||||||||||||||||||||
| 86 | processorArchitecture => '*', | ||||||||||||||||||||||||||||
| 87 | publicKeyToken => 'hjdajhahdsa7sadhaskl', | ||||||||||||||||||||||||||||
| 88 | }; | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | $manifest->add_dependency($info); | ||||||||||||||||||||||||||||
| 91 | $exe->set_manifest($manifest); | ||||||||||||||||||||||||||||
| 92 | $exe->write; | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | This module parses and manipulates application and assembly | ||||||||||||||||||||||||||||
| 99 | manifests used in MS Windows executables and DLLs. It is | ||||||||||||||||||||||||||||
| 100 | part of the Win32::Exe distribution. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =head1 METHODS | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =head2 Constructors | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head3 new | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Win32::Exe::Manifest->new($xml, $type); | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | Create a new manifest instance from the manifest xml in $xml. The | ||||||||||||||||||||||||||||
| 111 | $type param is optional and may contain 'application' (the default), | ||||||||||||||||||||||||||||
| 112 | or 'assembly'. | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Manifest objects can also be created using Win32::Exe | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | my $exe = Win32:::Exe->new('somefilepath'); | ||||||||||||||||||||||||||||
| 117 | my $manifest = $exe->get_manifest if $exe->has_manifest; | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=21.7
Pod
documented
| |||||||||||||||||||||||||||||
| 122 | 3 | my ($class, $xml, $type) = @_; | |||||||||||||||||||||||||||
| 123 | 3 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 124 | 3 | ▶ | $xml = $self->get_default_manifest() if !$xml; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 3 | ▶ | $type = 'application' if !$type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 3 | ▶ | $type =~ /^(application|assembly)$/ or croak(qq(Invalid manifest type : $type : valid types are 'application', 'assembly')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 3 | $self->{_w32_exe_schema} = $self->get_default_schema; | |||||||||||||||||||||||||||
| 128 | 3 | $self->{_w32_exe_datatype} = $type; | |||||||||||||||||||||||||||
| 129 | 3 | $self->{_w32_exe_manifestid} = 1; | |||||||||||||||||||||||||||
| 130 | 3 | my $handler = Win32::Exe::Manifest::Parser->new( $self->get_parser_config ); | |||||||||||||||||||||||||||
| 131 | 0 | ▶ | while( $xml =~ s/""/"/g ) { carp qq(Manifest has badly formed value quotes); } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 3 | $self->{_w32_exe_dataref} = $handler->xml_in( $xml ); | |||||||||||||||||||||||||||
| 133 | 0 | $self->_compress_schema(); | |||||||||||||||||||||||||||
| 134 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 135 | 0 | ▶ | croak('Manifest XML had errors: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 0 | return $self; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =head2 Output | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =head3 output | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | my $xml = $manifest->output; | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Returns a formated $xml string containing all edits and changes made | ||||||||||||||||||||||||||||
| 146 | using Win32::Exe::Manifest | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | =cut | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub output { | ||||||||||||||||||||||||||
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 152 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 153 | 0 | my $handler = Win32::Exe::Manifest::Parser->new( $self->get_parser_config ); | |||||||||||||||||||||||||||
| 154 | 0 | my $ref = $self->refhash; | |||||||||||||||||||||||||||
| 155 | 0 | $self->_expand_schema(); | |||||||||||||||||||||||||||
| 156 | 0 | my $xml = $handler->xml_out( $ref ); | |||||||||||||||||||||||||||
| 157 | 0 | $self->_compress_schema(); | |||||||||||||||||||||||||||
| 158 | 0 | return $xml; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | =head2 Application Identity | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =head3 set_assembly_name | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | $manifest->set_assembly_name('My.Application.Name'); | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Set the application or assembly name. The name should take the form of a progid | ||||||||||||||||||||||||||||
| 168 | and should not include any spaces. | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | =head3 get_assembly_name | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | my $appname = $manifest->get_assembly_name; | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | Return the assembly or application name from the manifest. | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub set_assembly_name { | ||||||||||||||||||||||||||
|
Subroutine
set_assembly_name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 181 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 182 | 0 | $self->refhash()->{assembly}->[0]->{assemblyIdentity}->[0]->{name} = $name; | |||||||||||||||||||||||||||
| 183 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 184 | 0 | ▶ | croak('Manifest XML had errors following set name: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub get_assembly_name { | ||||||||||||||||||||||||||
|
Subroutine
get_assembly_name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 189 | 0 | my $ref = $self->refhash(); | |||||||||||||||||||||||||||
| 190 | 0 | ▶ | return (exists($ref->{assembly}->[0]->{assemblyIdentity}->[0]->{name})) ? $ref->{assembly}->[0]->{assemblyIdentity}->[0]->{name} : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | =head3 set_assembly_description | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | $manifest->set_assembly_description('My Application Description'); | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | Set the application description. The description is an informative string. | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | =head3 get_assembly_decription | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | my $desc = $manifest->get_assembly_description; | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | Return the assembly description from the manifest. | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub set_assembly_description { | ||||||||||||||||||||||||||
|
Subroutine
set_assembly_description: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 0 | my($self, $desc) = @_; | |||||||||||||||||||||||||||
| 211 | 0 | my $valuename = $self->default_content; | |||||||||||||||||||||||||||
| 212 | 0 | $self->refhash()->{assembly}->[0]->{description}->[0]->{$valuename} = $desc; | |||||||||||||||||||||||||||
| 213 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 214 | 0 | ▶ | croak('Manifest XML had errors following set description: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub get_assembly_description { | ||||||||||||||||||||||||||
|
Subroutine
get_assembly_description: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 219 | 0 | my $valuename = $self->default_content; | |||||||||||||||||||||||||||
| 220 | 0 | my $ref = $self->refhash(); | |||||||||||||||||||||||||||
| 221 | 0 | ▶ | return (exists($ref->{assembly}->[0]->{description}->[0]->{$valuename})) ? $ref->{assembly}->[0]->{description}->[0]->{$valuename} : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =head3 set_assembly_version | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | $manifest->set_assembly_version('1.7.8.34456'); | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | Set the application or assembly version. The version should take the form of | ||||||||||||||||||||||||||||
| 229 | 'n.n.n.n' where each n is a number between 0-65535 inclusive. | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =head3 get_assembly_version | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | my $version = $manifest->get_assembly_version; | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | Return the assembly or application version from the manifest. | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =cut | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | sub set_assembly_version { | ||||||||||||||||||||||||||
|
Subroutine
set_assembly_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 242 | 0 | my($self, $version) = @_; | |||||||||||||||||||||||||||
| 243 | 0 | $self->refhash()->{assembly}->[0]->{assemblyIdentity}->[0]->{version} = $version; | |||||||||||||||||||||||||||
| 244 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 245 | 0 | ▶ | croak('Manifest XML had errors following set version: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub get_assembly_version { | ||||||||||||||||||||||||||
|
Subroutine
get_assembly_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 249 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 250 | 0 | my $ref = $self->refhash(); | |||||||||||||||||||||||||||
| 251 | 0 | ▶ | return (exists($ref->{assembly}->[0]->{assemblyIdentity}->[0]->{version})) ? $ref->{assembly}->[0]->{assemblyIdentity}->[0]->{version} : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =head3 set_assembly_language | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | $manifest->set_assembly_language($langid); | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | Set the application or assembly language. The language id is the | ||||||||||||||||||||||||||||
| 259 | DHTML language code. If you want to set 'language neutral' then pass | ||||||||||||||||||||||||||||
| 260 | '*' for the value. | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | see : L<http://msdn.microsoft.com/en-us/library/ms533052(VS.85).aspx> | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =head3 get_assembly_language | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | my $langid = $manifest->get_assembly_language; | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | Return the assembly or application language from the manifest. If there | ||||||||||||||||||||||||||||
| 270 | is no language id in the manifest, the method will return '*' | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =cut | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub set_assembly_language { | ||||||||||||||||||||||||||
|
Subroutine
set_assembly_language: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 276 | 0 | my($self, $newval) = @_; | |||||||||||||||||||||||||||
| 277 | 0 | $self->refhash()->{assembly}->[0]->{assemblyIdentity}->[0]->{language} = $newval; | |||||||||||||||||||||||||||
| 278 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 279 | 0 | ▶ | croak('Manifest XML had errors following set language: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub get_assembly_language { | ||||||||||||||||||||||||||
|
Subroutine
get_assembly_language: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 283 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 284 | 0 | my $ref = $self->refhash(); | |||||||||||||||||||||||||||
| 285 | 0 | ▶ | return (exists($ref->{assembly}->[0]->{assemblyIdentity}->[0]->{language})) ? $ref->{assembly}->[0]->{assemblyIdentity}->[0]->{language} : '*'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =head3 set_assembly_architecture | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | $manifest->set_assembly_architecture($arch); | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | Set the application or assembly architecture. Accepted values are : | ||||||||||||||||||||||||||||
| 293 | x86 msil ia64 amd64 *. Note the lowercase format. If you want your manifest | ||||||||||||||||||||||||||||
| 294 | to be architecture neutral, set architecture to '*'. | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | =head3 get_assembly_architecture | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | my $arch = $manifest->get_assembly_architecture; | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | Return the assembly or application architecture from the manifest. | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | =cut | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub set_assembly_architecture { | ||||||||||||||||||||||||||
|
Subroutine
set_assembly_architecture: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 307 | 0 | my($self, $newval) = @_; | |||||||||||||||||||||||||||
| 308 | 0 | $self->refhash()->{assembly}->[0]->{assemblyIdentity}->[0]->{processorArchitecture} = $newval; | |||||||||||||||||||||||||||
| 309 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 310 | 0 | ▶ | croak('Manifest XML had errors following set processorArchitecture: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub get_assembly_architecture { | ||||||||||||||||||||||||||
|
Subroutine
get_assembly_architecture: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 314 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 315 | 0 | my $ref = $self->refhash(); | |||||||||||||||||||||||||||
| 316 | 0 | ▶ | return (exists($ref->{assembly}->[0]->{assemblyIdentity}->[0]->{processorArchitecture})) ? $ref->{assembly}->[0]->{assemblyIdentity}->[0]->{processorArchitecture} : '*'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | =head2 Trust and Security | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =head3 set_execution_level | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | $manifest->set_execution_level($level); | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | Set the application execution level. Accepted values are : asInvoker, | ||||||||||||||||||||||||||||
| 326 | highestAvailable, requireAdministrator, none. If you pass the value | ||||||||||||||||||||||||||||
| 327 | 'none', any trustInfo section will be removed from the manifest. | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | See L<http://msdn.microsoft.com/en-us/library/bb756929.aspx> | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | =head3 get_execution_level | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | my $level = $manifest->get_execution_level; | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | Return the application execution level. | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =cut | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 0 | ▶ | sub set_execution_level { | ||||||||||||||||||||||||||
|
Subroutine
set_execution_level: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 342 | 0 | my($self, $level) = @_; | |||||||||||||||||||||||||||
| 343 | 0 | ▶ | $level =~ /^(asInvoker|requireAdministrator|highestAvailable|none)$/ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 344 | or croak(qq(Invalid exec level '$level'. Valid levels are 'asInvoker', 'requireAdministrator', 'highestAvailable', 'none')); | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 347 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 348 | 0 | my $xmlns = $schema->{elementtypes}->{trustInfo}->{attributes}->{xmlns}->{default}; | |||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 0 | ▶ | if($level eq 'none') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 351 | # delete element and collapse tree if empty | ||||||||||||||||||||||||||||
| 352 | 0 | $self->_delete_collapse_tree($ref, [ qw(trustInfo security requestedPrivileges requestedExecutionLevel) ] ); | |||||||||||||||||||||||||||
| 353 | } else { | ||||||||||||||||||||||||||||
| 354 | # create value if it does not exist | ||||||||||||||||||||||||||||
| 355 | 0 | my $writeref = $self->_get_first_tree_node($ref, [ qw(trustInfo security requestedPrivileges requestedExecutionLevel) ], undef ); | |||||||||||||||||||||||||||
| 356 | 0 | $writeref->{level} = $level; | |||||||||||||||||||||||||||
| 357 | 0 | ▶ | $writeref->{uiAccess} = 'false' if not exists($writeref->{uiAccess}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | # in all cases, dump any namespace definitions - which cause crashes on some OS / namespace combos | ||||||||||||||||||||||||||||
| 361 | # and fix trustInfo namespace decl | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 0 | $self->_fixup_namespace( $ref, 'trustInfo', $xmlns ); | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 366 | 0 | ▶ | croak('Manifest XML had errors following set execution level: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub get_execution_level { | ||||||||||||||||||||||||||
|
Subroutine
get_execution_level: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 371 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 372 | 0 | ▶ | return 'none' if not exists($ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}->[0]->{level}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | 0 | return $ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}->[0]->{level}; | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =head3 set_uiaccess | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | $manifest->set_uiaccess($needed); | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | Set the application uiAccess requirement in the trustInfo manifest section. | ||||||||||||||||||||||||||||
| 381 | Accepted values are 'true', 'false'. If no trustInfo section exists, one is | ||||||||||||||||||||||||||||
| 382 | created with the execution level set to 'asInvoker'. | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | See L<http://msdn.microsoft.com/en-us/library/bb756929.aspx> | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | =head3 get_uiaccess | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | my $accessneeded = $manifest->get_uiaccess; | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | Return the uiAccess setting from the trustInfo structure. If no trustInfo | ||||||||||||||||||||||||||||
| 392 | structure exists, method returns undef. | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | =cut | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub set_uiaccess { | ||||||||||||||||||||||||||
|
Subroutine
set_uiaccess: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 398 | 0 | my ($self, $access) = @_; | |||||||||||||||||||||||||||
| 399 | 0 | ▶ | $access =~ /^(true|false)$/ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | or croak(qq(Invalid uiAccess setting '$access'. Valid settings are 'true', 'false')); | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 403 | 0 | ▶ | if(exists($ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}->[0]->{uiAccess})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | 0 | $ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}->[0]->{uiAccess} = $access; | |||||||||||||||||||||||||||
| 405 | } else { | ||||||||||||||||||||||||||||
| 406 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 407 | 0 | my $xmlns = $schema->{elementtypes}->{trustInfo}->{attributes}->{xmlns}->{default}; | |||||||||||||||||||||||||||
| 408 | 0 | $ref->{trustInfo} = [ { xmlns => $xmlns, security => [ { requestedPrivileges => [ { requestedExecutionLevel => [ { level => 'asInvoker', uiAccess => $access } ] } ] } ] } ]; | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 411 | 0 | ▶ | croak('Manifest XML had errors following set uiAccess: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | 0 | ▶ | sub get_uiaccess { | ||||||||||||||||||||||||||
|
Subroutine
get_uiaccess: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 415 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 416 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 417 | 0 | ▶ | return undef if not exists($ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | 0 | return $ref->{trustInfo}->[0]->{security}->[0]->{requestedPrivileges}->[0]->{requestedExecutionLevel}->[0]->{uiAccess}; | |||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | =head2 Application Dependencies | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | =head3 set_resource_id | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | $manifest->set_resource_id($id); | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | Set the resource Id for the manifest. Valid id's are 1, 2 and 3. The default | ||||||||||||||||||||||||||||
| 428 | is 1. Don't set this unless you are fully aware of the effects. | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | See L<http://msdn.microsoft.com/en-us/library/aa376607(VS.85).aspx> | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | =head3 get_resource_id | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | my $id = $manifest->get_resource_id(); | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | Return the resource Id for the manifest. | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =cut | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub get_resource_id { $_[0]->{_w32_exe_manifestid} } | ||||||||||||||||||||||||||
|
Subroutine
get_resource_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub set_resource_id { | ||||||||||||||||||||||||||
|
Subroutine
set_resource_id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 444 | 0 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 445 | 0 | ▶ | $id =~ /^(1|2|3)$/ or croak(qq(invalid manifest resource id $id. Valid values are 1,2,3)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 446 | 0 | $self->{_w32_exe_manifestid} = $id; | |||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | =head3 add_common_controls | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | $manifest->add_common_controls(); | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | Add a dependency on minimum version 6.0.0.0 of the Microsoft.Windows.Common-Controls shared | ||||||||||||||||||||||||||||
| 454 | library. This is normally done with GUI applications to use themed controls on Windows XP | ||||||||||||||||||||||||||||
| 455 | and above. | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =cut | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 0 | ▶ | sub add_common_controls { $_[0]->add_template_dependency('Microsoft.Windows.Common-Controls'); } | ||||||||||||||||||||||||||
|
Subroutine
add_common_controls: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 0 | ▶ | sub add_template_dependency { | ||||||||||||||||||||||||||
|
Subroutine
add_template_dependency: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 463 | 0 | my($self, $assemblyname) = @_; | |||||||||||||||||||||||||||
| 464 | 0 | my $tmpl = $self->get_dependency_template($assemblyname); | |||||||||||||||||||||||||||
| 465 | 0 | ▶ | croak(qq(No template found for dependency $assemblyname)) if !$tmpl; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 466 | 0 | $self->add_dependency($tmpl); | |||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | =head3 add_dependency | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | $manifest->add_dependency($info); | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | Add a dependency on the assembly detailed in the $info hash reference. The contents of | ||||||||||||||||||||||||||||
| 474 | $info should be of the form: | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | my $info = { type => 'win32', | ||||||||||||||||||||||||||||
| 477 | name => 'Dependency.Prog.Id', | ||||||||||||||||||||||||||||
| 478 | version => 1.0.0.0, | ||||||||||||||||||||||||||||
| 479 | language => '*', | ||||||||||||||||||||||||||||
| 480 | processorArchitecture => '*', | ||||||||||||||||||||||||||||
| 481 | publicKeyToken => 'hjdajhahdsa7sadhaskl', | ||||||||||||||||||||||||||||
| 482 | }; | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | Note that the version should be the least specific that your application requires. For | ||||||||||||||||||||||||||||
| 485 | example, a version of '2.0.0.0' would mean the system loads the first matching | ||||||||||||||||||||||||||||
| 486 | assembly it finds with a version of at least '2.0.0.0'. | ||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | See: L<http://msdn.microsoft.com/en-us/library/aa374219(v=VS.85).aspx> | ||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | =cut | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | ▶ | sub add_dependency { | ||||||||||||||||||||||||||
|
Subroutine
add_dependency: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 494 | 0 | my($self, $proto) = @_; | |||||||||||||||||||||||||||
| 495 | 0 | my $name = $proto->{name}; | |||||||||||||||||||||||||||
| 496 | 0 | $proto->{type} = 'win32'; | |||||||||||||||||||||||||||
| 497 | 0 | ▶ | $proto->{version} ||= '0.0.0.0'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$proto->{"version"} ||= "0.0.0.0"
MC/DC0%0/1
$proto->{"version"} ||= "0.0.0.0"
$proto->{"version"}
Truth table0%0/2
A
A= $proto->{"version"}
| |||||||||||||||||||||||||||||
| 498 | 0 | ▶ | $proto->{language} ||= '*'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$proto->{"language"} ||= "*"
MC/DC0%0/1
$proto->{"language"} ||= "*"
$proto->{"language"}
Truth table0%0/2
A
A= $proto->{"language"}
| |||||||||||||||||||||||||||||
| 499 | 0 | ▶ | $proto->{processorArchitecture} ||= '*'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$proto->{"processorArchitecture"} ||= "*"
MC/DC0%0/1
$proto->{"processorArchitecture"} ||= "*"
$proto->{"processorArchitecture"}
Truth table0%0/2
A
A= $proto->{"processorArchitecture"}
| |||||||||||||||||||||||||||||
| 500 | 0 | my %vals = %$proto; | |||||||||||||||||||||||||||
| 501 | 0 | ▶ | if( defined(my $depindex = $self->_get_dependendency_index($name)) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 502 | 0 | $self->refhash()->{assembly}->[0]->{dependency}->[$depindex]->{dependentAssembly}->[0]->{assemblyIdentity}->[0] = \%vals; | |||||||||||||||||||||||||||
| 503 | } else { | ||||||||||||||||||||||||||||
| 504 | 0 | ▶ | $self->refhash()->{assembly}->[0]->{dependency} = [] if not exists $self->refhash()->{assembly}->[0]->{dependency}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 505 | 0 | my $newdep = { dependentAssembly => [ { assemblyIdentity => [ \%vals ] } ] }; | |||||||||||||||||||||||||||
| 506 | 0 | push @{ $self->refhash()->{assembly}->[0]->{dependency} } , $newdep; | |||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 509 | 0 | ▶ | croak('Manifest XML had errors following dependency addition: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | =head3 remove_dependency | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | $manifest->remove_dependency($progid); | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | Remove a dependency with the $progid. For example, passing a $progid of | ||||||||||||||||||||||||||||
| 517 | 'Microsoft.Windows.Common-Controls' will remove the dependency added via | ||||||||||||||||||||||||||||
| 518 | 'add_common_controls' from the manifest. | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | =cut | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | 0 | ▶ | sub remove_dependency { | ||||||||||||||||||||||||||
|
Subroutine
remove_dependency: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 524 | 0 | my($self, $depname) = @_; | |||||||||||||||||||||||||||
| 525 | 0 | ▶ | if( defined(my $depindex = $self->_get_dependendency_index($depname)) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 526 | 0 | my $ref = $self->refhash()->{assembly}->[0]->{dependency}; | |||||||||||||||||||||||||||
| 527 | 0 | my @depends = @$ref; | |||||||||||||||||||||||||||
| 528 | 0 | splice(@depends, $depindex, 1); | |||||||||||||||||||||||||||
| 529 | 0 | $self->refhash()->{assembly}->[0]->{dependency} = \@depends; | |||||||||||||||||||||||||||
| 530 | 0 | return 1; | |||||||||||||||||||||||||||
| 531 | } else { | ||||||||||||||||||||||||||||
| 532 | 0 | return 0; | |||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | =head3 get_dependency | ||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||
| 538 | my $info = $manifest->get_dependency($progid); | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | Return a dependency info hash for a dependency in the manifest with the 'name' | ||||||||||||||||||||||||||||
| 541 | $progid. The info hash is a reference to a hash with the format: | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | { type => 'win32', | ||||||||||||||||||||||||||||
| 544 | name => 'Dependency.Prog.Id', | ||||||||||||||||||||||||||||
| 545 | version => 1.0.0.0, | ||||||||||||||||||||||||||||
| 546 | language => '*', | ||||||||||||||||||||||||||||
| 547 | processorArchitecture => '*', | ||||||||||||||||||||||||||||
| 548 | publicKeyToken => 'hjdajhahdsa7sadhaskl', | ||||||||||||||||||||||||||||
| 549 | }; | ||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||
| 551 | If there is no dependency with the name $progid, returns undef. | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | =cut | ||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | 0 | ▶ | sub get_dependency { | ||||||||||||||||||||||||||
|
Subroutine
get_dependency: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 557 | 0 | my($self, $depname) = @_; | |||||||||||||||||||||||||||
| 558 | 0 | ▶ | if( defined(my $depindex = $self->_get_dependendency_index($depname)) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 559 | 0 | my $ref = $self->refhash()->{assembly}->[0]->{dependency}->[$depindex]->{dependentAssembly}->[0]->{assemblyIdentity}->[0]; | |||||||||||||||||||||||||||
| 560 | 0 | my %vals = %$ref; | |||||||||||||||||||||||||||
| 561 | 0 | return \%vals; | |||||||||||||||||||||||||||
| 562 | } else { | ||||||||||||||||||||||||||||
| 563 | 0 | return undef; | |||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | =head3 get_dependencies | ||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | my @deps = $manifest->get_dependencies($progid); | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | Return an array of hash references, one for each dependency in the manifest. | ||||||||||||||||||||||||||||
| 573 | Each member is a reference to a hash with the format: | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | { type => 'win32', | ||||||||||||||||||||||||||||
| 576 | name => 'Dependency.Prog.Id', | ||||||||||||||||||||||||||||
| 577 | version => 1.0.0.0, | ||||||||||||||||||||||||||||
| 578 | language => '*', | ||||||||||||||||||||||||||||
| 579 | processorArchitecture => '*', | ||||||||||||||||||||||||||||
| 580 | publicKeyToken => 'hjdajhahdsa7sadhaskl', | ||||||||||||||||||||||||||||
| 581 | }; | ||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | If there are no dependencies, returns an empty array. | ||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | =cut | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | 0 | ▶ | sub get_dependencies { | ||||||||||||||||||||||||||
|
Subroutine
get_dependencies: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 589 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 590 | 0 | my @depends = (); | |||||||||||||||||||||||||||
| 591 | 0 | ▶ | return (@depends) if not exists $self->refhash()->{assembly}->[0]->{dependency}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 592 | 0 | for my $dependency ( @{ $self->refhash()->{assembly}->[0]->{dependency} } ) { | |||||||||||||||||||||||||||
| 593 | 0 | my $dep = $dependency->{dependentAssembly}->[0]->{assemblyIdentity}->[0]; | |||||||||||||||||||||||||||
| 594 | 0 | my %vals = %$dep; | |||||||||||||||||||||||||||
| 595 | 0 | push(@depends, \%vals); | |||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||
| 597 | 0 | return ( @depends ); | |||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||
| 601 | =head2 Compatibility Settings | ||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | =head3 set_compatibility | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | $manifest->set_compatibility( ('Windows Vista') ); | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | Set the operating system feature compatibility flags. Parameter is a list of operating | ||||||||||||||||||||||||||||
| 609 | systems that the application targets. In addition to the opertating system identifier | ||||||||||||||||||||||||||||
| 610 | keys, this method also accepts the shorthand strings 'Windows Vista' and 'Windows 7'. | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | See : L<http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx> | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | =head3 get_compatibility | ||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||
| 617 | my @osids = $manifest->get_compatibility(); | ||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | Returns a list of operating system identifier keys that the manifest notes as targetted | ||||||||||||||||||||||||||||
| 620 | operating systems. You can convert these os ids to the shorthand strings 'Windows Vista' | ||||||||||||||||||||||||||||
| 621 | and 'Windows 7' using the method | ||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | my $shortstring = $manifest->get_osname_from_osid($osid); | ||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | There is a reverse method | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | my $osid = $manifest->get_osid_from_osname($shortstring); | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | NOTE: Don't set this unless you fully understand the effects. | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | See : L<http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx> | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||
| 634 | =cut | ||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | 0 | ▶ | sub set_compatibility { | ||||||||||||||||||||||||||
|
Subroutine
set_compatibility: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 637 | 0 | my($self, @vals) = @_; | |||||||||||||||||||||||||||
| 638 | 0 | ▶ | return if ! scalar(@vals); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 639 | 0 | my @osblock = (); | |||||||||||||||||||||||||||
| 640 | 0 | for my $val ( @vals ) { | |||||||||||||||||||||||||||
| 641 | 0 | my $compat = $val; | |||||||||||||||||||||||||||
| 642 | 0 | ▶ | $compat = '{e2011457-1546-43c5-a5fe-008deee3d3f0}' if(lc($compat) eq 'windows vista'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 643 | 0 | ▶ | $compat = '{35138b9a-5d96-4fbd-8e2d-a2440225f93a}' if(lc($compat) eq 'windows 7'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 644 | 0 | ▶ | croak(qq(Invalid OS key '$val' for compatibility)) if !Win32::Exe::Manifest::Parser->validate_osid($compat); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 645 | 0 | push(@osblock, { Id => $compat }); | |||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||
| 647 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 648 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 649 | 0 | my $xmlns = $schema->{elementtypes}->{compatibility}->{attributes}->{xmlns}->{default}; | |||||||||||||||||||||||||||
| 650 | 0 | $ref->{compatibility} = [ { xmlns => $xmlns, application => [ { supportedOS => \@osblock, }, ], }, ]; | |||||||||||||||||||||||||||
| 651 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 652 | 0 | ▶ | croak('Manifest XML had errors following set compatibility: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||
| 655 | 0 | ▶ | sub get_compatibility { | ||||||||||||||||||||||||||
|
Subroutine
get_compatibility: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 656 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 657 | 0 | my @compats = (); | |||||||||||||||||||||||||||
| 658 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 659 | 0 | ▶ | if(exists($ref->{compatibility})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 660 | 0 | my @oids = @{ $ref->{compatibility}->[0]->{application}->[0]->{supportedOS} }; | |||||||||||||||||||||||||||
| 661 | 0 | for my $oidref ( @oids ) { | |||||||||||||||||||||||||||
| 662 | 0 | my $oskey = $oidref->{Id}; | |||||||||||||||||||||||||||
| 663 | 0 | push(@compats, $oskey); | |||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||
| 666 | 0 | return (@compats); | |||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||
| 669 | =head3 set_dpiaware | ||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||
| 671 | $manifest->set_dpdaware( 'true' ); | ||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | Set section in the manifest if the application is dpi aware. Accepts values | ||||||||||||||||||||||||||||
| 674 | true, false, and none. If the value 'none' is passed, the application\windowsSettings | ||||||||||||||||||||||||||||
| 675 | section is removed from the manifest entirely. | ||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | See : L<http://msdn.microsoft.com/en-us/library/ee308410(VS.85).aspx> | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||
| 680 | =head3 get_dpiaware | ||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||
| 682 | $manifest->set_dpdaware( 'true' ); | ||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||
| 684 | Return the dpiAware setting from the manifest, if any. If there is no setting, | ||||||||||||||||||||||||||||
| 685 | the method returns undef. | ||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | See : L<http://msdn.microsoft.com/en-us/library/ee308410(VS.85).aspx> | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | =cut | ||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||
| 692 | 0 | ▶ | sub set_dpiaware { | ||||||||||||||||||||||||||
|
Subroutine
set_dpiaware: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 693 | 0 | my ($self, $setval) = @_; | |||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||
| 695 | 0 | ▶ | $setval =~ /^(true|false|none)$/i or croak(qq(Invalid value for set_dpiaware '$setval'. Valid values are true:false:none)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 696 | 0 | $setval = lc($setval); | |||||||||||||||||||||||||||
| 697 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 698 | 0 | my $elementvaluename = $self->default_content; | |||||||||||||||||||||||||||
| 699 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 700 | 0 | my $namealias = $schema->{namespace}->{'urn:schemas-microsoft-com:asm.v3'}; | |||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | # handle remove value | ||||||||||||||||||||||||||||
| 703 | 0 | ▶ | if($setval eq 'none') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 704 | # delete element and collapse tree if empty | ||||||||||||||||||||||||||||
| 705 | 0 | $self->_delete_collapse_tree($ref, [ qw(application windowSettings dpiAware) ] ); | |||||||||||||||||||||||||||
| 706 | } else { | ||||||||||||||||||||||||||||
| 707 | # create value if it does not exist | ||||||||||||||||||||||||||||
| 708 | 0 | my $writeref = $self->_get_first_tree_node($ref, [ qw(application windowsSettings) ], $namealias ); | |||||||||||||||||||||||||||
| 709 | 0 | $writeref->{dpiAware} = [ { $elementvaluename => $setval } ]; | |||||||||||||||||||||||||||
| 710 | # add xmlns for windowsSettings | ||||||||||||||||||||||||||||
| 711 | 0 | my $xmlns = $schema->{elementtypes}->{windowsSettings}->{attributes}->{xmlns}->{default}; | |||||||||||||||||||||||||||
| 712 | 0 | $ref->{application}->[0]->{windowsSettings}->[0]->{xmlns} = $xmlns; | |||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||
| 714 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 715 | 0 | ▶ | croak('Manifest XML had errors after dpiAware setting: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||
| 718 | 0 | ▶ | sub get_dpiaware { | ||||||||||||||||||||||||||
|
Subroutine
get_dpiaware: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 719 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 720 | 0 | my $ref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 721 | 0 | my $elementvaluename = $self->default_content; | |||||||||||||||||||||||||||
| 722 | 0 | ▶ | return 'none' if(not exists($ref->{application}->[0]->{windowsSettings}->[0]->{dpiAware}->[0]->{$elementvaluename})); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 723 | 0 | return $ref->{application}->[0]->{windowsSettings}->[0]->{dpiAware}->[0]->{$elementvaluename}; | |||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||
| 726 | =head2 Manifest Information | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | =head3 get_manifest_type | ||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||
| 730 | my $type = $manifest->get_manifest_type; | ||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||
| 732 | Returns the manifest type ( 'application' or 'assembly' ); | ||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||
| 735 | =cut | ||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||
| 737 | 0 | ▶ | sub get_manifest_type { $_[0]->{_w32_exe_datatype}; } | ||||||||||||||||||||||||||
|
Subroutine
get_manifest_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||
| 740 | 0 | ▶ | sub get_current_schema { $_[0]->{_w32_exe_schema}; } | ||||||||||||||||||||||||||
|
Subroutine
get_current_schema: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | 0 | ▶ | sub set_current_schema { | ||||||||||||||||||||||||||
|
Subroutine
set_current_schema: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 744 | 0 | my($self, $schema) = @_; | |||||||||||||||||||||||||||
| 745 | 0 | $self->{_w32_exe_schema} = $schema; | |||||||||||||||||||||||||||
| 746 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 747 | 0 | ▶ | croak('Manifest XML had errors following set schema: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||
| 750 | 3 | ▶ | sub default_xmldecl { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' } | ||||||||||||||||||||||||||
|
Subroutine
default_xmldecl: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||
| 752 | 3 | ▶ | sub default_content { 'elementValue' } | ||||||||||||||||||||||||||
|
Subroutine
default_content: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | 3 | ▶ | sub get_parser_config { | ||||||||||||||||||||||||||
|
Subroutine
get_parser_config: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 755 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 756 | 3 | my %config = ( | |||||||||||||||||||||||||||
| 757 | KeepRoot => 1, | ||||||||||||||||||||||||||||
| 758 | ForceArray => 1, | ||||||||||||||||||||||||||||
| 759 | KeyAttr => {}, | ||||||||||||||||||||||||||||
| 760 | XMLDecl => $self->default_xmldecl, | ||||||||||||||||||||||||||||
| 761 | ForceContent => 1, | ||||||||||||||||||||||||||||
| 762 | ContentKey => $self->default_content, | ||||||||||||||||||||||||||||
| 763 | # AttrIndent => 1, | ||||||||||||||||||||||||||||
| 764 | ); | ||||||||||||||||||||||||||||
| 765 | 3 | return %config; | |||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||
| 768 | 0 | ▶ | sub refhash { $_[0]->{_w32_exe_dataref}; } | ||||||||||||||||||||||||||
|
Subroutine
refhash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||
| 771 | 0 | ▶ | sub merge_manifest { | ||||||||||||||||||||||||||
|
Subroutine
merge_manifest: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 772 | 0 | my($self, $xml) = @_; | |||||||||||||||||||||||||||
| 773 | 0 | my $mergefest; | |||||||||||||||||||||||||||
| 774 | 0 | my $class = ref($self); | |||||||||||||||||||||||||||
| 775 | 0 | eval { $mergefest = $class->new($xml, $self->get_manifest_type); }; | |||||||||||||||||||||||||||
| 776 | 0 | ▶ | croak(qq(Merging $@)) if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 777 | 0 | my $newref = $mergefest->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 778 | 0 | my $oldref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 779 | 0 | $self->_merge_element_merge('assembly', $oldref, $newref); | |||||||||||||||||||||||||||
| 780 | 0 | my $errors = $self->validate_errors; | |||||||||||||||||||||||||||
| 781 | 0 | ▶ | croak('Manifest had errors after merging: ' . $errors) if $errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||
| 785 | 0 | ▶ | sub get_osname_from_osid { | ||||||||||||||||||||||||||
|
Subroutine
get_osname_from_osid: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 786 | 0 | my($self, $osid) = @_; | |||||||||||||||||||||||||||
| 787 | 0 | my $name = 'Unknown Windows Version'; | |||||||||||||||||||||||||||
| 788 | 0 | ▶ | $name = 'Windows Vista' if $osid =~ /e2011457-1546-43c5-a5fe-008deee3d3f0/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 789 | 0 | ▶ | $name = 'Windows 7' if $osid =~ /35138b9a-5d96-4fbd-8e2d-a2440225f93a/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 790 | 0 | return $name; | |||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||
| 793 | 0 | ▶ | sub get_osid_from_osname { | ||||||||||||||||||||||||||
|
Subroutine
get_osid_from_osname: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 794 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 795 | 0 | my $osid = undef; | |||||||||||||||||||||||||||
| 796 | 0 | ▶ | $osid = '{e2011457-1546-43c5-a5fe-008deee3d3f0}' if(lc($name) eq 'windows vista'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 797 | 0 | ▶ | $osid = '{35138b9a-5d96-4fbd-8e2d-a2440225f93a}' if(lc($name) eq 'windows 7'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 798 | 0 | return $osid; | |||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||
| 801 | 0 | ▶ | sub _get_dependendency_index { | ||||||||||||||||||||||||||
|
Subroutine
_get_dependendency_index: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 802 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 803 | 0 | my $exref = $self->refhash()->{assembly}->[0]; | |||||||||||||||||||||||||||
| 804 | 0 | ▶ | return undef if not exists $exref->{dependency}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 805 | 0 | my $rval = undef; | |||||||||||||||||||||||||||
| 806 | 0 | my @existing = @{ $exref->{dependency} }; | |||||||||||||||||||||||||||
| 807 | 0 | ▶ | for(my $i = 0; $i < @existing; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 808 | 0 | my $depname = $existing[$i]->{dependentAssembly}->[0]->{assemblyIdentity}->[0]->{name}; | |||||||||||||||||||||||||||
| 809 | 0 | ▶ | if($depname eq $name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 810 | 0 | $rval = $i; | |||||||||||||||||||||||||||
| 811 | 0 | last; | |||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||
| 814 | 0 | return $rval; | |||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||
| 817 | 0 | ▶ | sub _get_first_tree_node { | ||||||||||||||||||||||||||
|
Subroutine
_get_first_tree_node: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 818 | 0 | my ($self, $ref, $paths, $namealias ) = @_; | |||||||||||||||||||||||||||
| 819 | 0 | my $newref = $ref; | |||||||||||||||||||||||||||
| 820 | 0 | ▶ | while(my $path = shift(@$paths) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 821 | 0 | ▶ | $newref->{$path} = [{}] if(not exists($newref->{$path})); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 822 | 0 | $newref = $newref->{$path}->[0]; | |||||||||||||||||||||||||||
| 823 | 0 | ▶ | $newref->{elementnamespace} = $namealias if $namealias; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||
| 825 | 0 | return $newref; | |||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | 0 | ▶ | sub _delete_collapse_tree { | ||||||||||||||||||||||||||
|
Subroutine
_delete_collapse_tree: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 829 | 0 | my ($self, $ref, $paths ) = @_; | |||||||||||||||||||||||||||
| 830 | 0 | my $rootkey = $paths->[0]; | |||||||||||||||||||||||||||
| 831 | 0 | my $deletekey = pop(@$paths); | |||||||||||||||||||||||||||
| 832 | 0 | my $delref = $ref; | |||||||||||||||||||||||||||
| 833 | 0 | my $dodelete = 1; | |||||||||||||||||||||||||||
| 834 | 0 | ▶ | while(my $checkpath = shift @$paths) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 835 | 0 | ▶ | if(exists($delref->{$checkpath}->[0])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 836 | 0 | $delref = $delref->{$checkpath}->[0]; | |||||||||||||||||||||||||||
| 837 | } else { | ||||||||||||||||||||||||||||
| 838 | 0 | $dodelete = 0; | |||||||||||||||||||||||||||
| 839 | 0 | last; | |||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||
| 842 | 0 | ▶ | delete($delref->{$deletekey}) if($dodelete && exists($delref->{$deletekey})); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dodelete and exists $delref->{$deletekey}
MC/DC0%0/2
$dodelete and exists $delref->{$deletekey}
$dodelete
exists $delref->{$deletekey}
Truth table0%0/3
A and B
A= $dodeleteB= exists $delref->{$deletekey}
| |||||||||||||||||||||||||||||
| 843 | 0 | ▶ | delete($delref->{elementnamespace}) if($dodelete && exists($delref->{elementnamespace})); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dodelete and exists $delref->{"elementnamespace"}
MC/DC0%0/2
$dodelete and exists $delref->{"elementnamespace"}
$dodelete
exists $delref->{"elementnamespace"}
Truth table0%0/3
A and B
A= $dodeleteB= exists $delref->{"elementnamespace"}
| |||||||||||||||||||||||||||||
| 844 | 0 | $self->_delete_if_empty($ref, $rootkey); | |||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||
| 847 | 0 | ▶ | sub _merge_element_merge { | ||||||||||||||||||||||||||
|
Subroutine
_merge_element_merge: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||
| 848 | 0 | my($self, $elementname, $exref, $mergeref) = @_; | |||||||||||||||||||||||||||
| 849 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 850 | 0 | my $elementvaluename = $self->default_content; | |||||||||||||||||||||||||||
| 851 | 0 | my $elementdef = $schema->{elementtypes}->{$elementname}; | |||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||
| 853 | 0 | my @keynames = (sort keys(%$mergeref)); | |||||||||||||||||||||||||||
| 854 | 0 | my %elementnames = (); | |||||||||||||||||||||||||||
| 855 | 0 | my %attributenames = (); | |||||||||||||||||||||||||||
| 856 | 0 | my $valuepresent = 0; | |||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||
| 858 | 0 | for my $kname(@keynames) { | |||||||||||||||||||||||||||
| 859 | 0 | ▶ | if( $kname eq $elementvaluename ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 860 | 0 | $valuepresent = 1; | |||||||||||||||||||||||||||
| 861 | } elsif(ref($mergeref->{$kname})) { | ||||||||||||||||||||||||||||
| 862 | 0 | $elementnames{$kname} = 1; | |||||||||||||||||||||||||||
| 863 | } else { | ||||||||||||||||||||||||||||
| 864 | 0 | $attributenames{$kname} = 1; | |||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||
| 868 | # merge value | ||||||||||||||||||||||||||||
| 869 | 0 | ▶ | if($valuepresent) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 870 | 0 | $exref->{$elementvaluename} = $mergeref->{$elementvaluename}; | |||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||
| 873 | # merge attributes | ||||||||||||||||||||||||||||
| 874 | 0 | for my $aname (sort keys( %attributenames )) { | |||||||||||||||||||||||||||
| 875 | 0 | $exref->{$aname} = $mergeref->{$aname}; | |||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | # merge elements | ||||||||||||||||||||||||||||
| 879 | 0 | for my $ename (sort keys( %elementnames )) { | |||||||||||||||||||||||||||
| 880 | 0 | ▶ | if(not exists($exref->{$ename})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 881 | # simple addition | ||||||||||||||||||||||||||||
| 882 | 0 | $exref->{$ename} = $mergeref->{$ename}; | |||||||||||||||||||||||||||
| 883 | 0 | next; | |||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||
| 885 | 0 | ▶ | if($ename eq 'dependency') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 886 | # handle dependency merge | ||||||||||||||||||||||||||||
| 887 | 0 | $self->_merge_dependencies( $exref, $mergeref ); | |||||||||||||||||||||||||||
| 888 | 0 | next; | |||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||
| 890 | 0 | my $maxallowed = $elementdef->{elements}->{$ename}->{max}; | |||||||||||||||||||||||||||
| 891 | 0 | ▶ | if($maxallowed == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 892 | 0 | $self->_merge_element_merge($ename, $exref->{$ename}->[0], $mergeref->{$ename}->[0]); | |||||||||||||||||||||||||||
| 893 | } else { | ||||||||||||||||||||||||||||
| 894 | 0 | push(@{ $exref->{$ename} }, @{ $mergeref->{$ename} }); | |||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||
| 899 | 0 | ▶ | sub _merge_dependencies { | ||||||||||||||||||||||||||
|
Subroutine
_merge_dependencies: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 900 | 0 | my($self, $exref, $mergeref) = @_; | |||||||||||||||||||||||||||
| 901 | 0 | my %existingdepends = (); | |||||||||||||||||||||||||||
| 902 | 0 | my %mergingdepends = (); | |||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||
| 904 | 0 | my @existing = @{ $exref->{dependency} }; | |||||||||||||||||||||||||||
| 905 | 0 | my @merging = @{ $mergeref->{dependency} }; | |||||||||||||||||||||||||||
| 906 | 0 | my @merged = (); | |||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | 0 | ▶ | for(my $i = 0; $i < @existing; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 909 | 0 | my $depname = $existing[$i]->{dependentAssembly}->[0]->{assemblyIdentity}->[0]->{name}; | |||||||||||||||||||||||||||
| 910 | 0 | $existingdepends{$depname} = $i; | |||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | 0 | ▶ | for(my $i = 0; $i < @merging; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 914 | 0 | my $depname = $merging[$i]->{dependentAssembly}->[0]->{assemblyIdentity}->[0]->{name}; | |||||||||||||||||||||||||||
| 915 | 0 | $mergingdepends{$depname} = $i; | |||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||
| 918 | 0 | foreach my $classname (sort keys(%existingdepends)) { | |||||||||||||||||||||||||||
| 919 | 0 | ▶ | push(@merged, $existing[$existingdepends{$classname}]) if not exists $mergingdepends{$classname} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||
| 922 | 0 | push(@merged, @merging); | |||||||||||||||||||||||||||
| 923 | 0 | $exref->{dependency} = \@merged; | |||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||
| 926 | 0 | ▶ | sub validate_errors { | ||||||||||||||||||||||||||
|
Subroutine
validate_errors: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 927 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 928 | 0 | eval { $self->validate_data; }; | |||||||||||||||||||||||||||
| 929 | 0 | ▶ | return ($@) ? $@ : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||
| 932 | 0 | ▶ | sub _fixup_namespace { | ||||||||||||||||||||||||||
|
Subroutine
_fixup_namespace: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 933 | 0 | my( $self, $ref, $keyname, $xmlns ) = @_; | |||||||||||||||||||||||||||
| 934 | 0 | for my $element( @{ $ref->{$keyname} } ) { | |||||||||||||||||||||||||||
| 935 | 0 | ▶ | $element->{xmlns} = $xmlns if $xmlns; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 936 | 0 | ▶ | delete($element->{elementnamespace}) if(exists($element->{elementnamespace})); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 937 | 0 | my @keynames = (sort keys(%$element)); | |||||||||||||||||||||||||||
| 938 | 0 | for my $subkeyname( @keynames ) { | |||||||||||||||||||||||||||
| 939 | 0 | ▶ | if(ref($element->{$subkeyname})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 940 | # a sub-element | ||||||||||||||||||||||||||||
| 941 | 0 | $self->_fixup_namespace($element, $subkeyname, undef ); | |||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||
| 947 | 0 | ▶ | sub _delete_if_empty { | ||||||||||||||||||||||||||
|
Subroutine
_delete_if_empty: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 948 | 0 | my($self, $ref, $refname) = @_; | |||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||
| 950 | # this element array is empty if it only contains namespace attributes | ||||||||||||||||||||||||||||
| 951 | # and all it's elements are similarly empty; | ||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||
| 953 | 0 | my $candelete = 1; | |||||||||||||||||||||||||||
| 954 | 0 | for my $element ( @{ $ref->{$refname} }) { | |||||||||||||||||||||||||||
| 955 | 0 | my @keynames = (sort keys(%$element)); | |||||||||||||||||||||||||||
| 956 | 0 | for my $keyname( @keynames ) { | |||||||||||||||||||||||||||
| 957 | 0 | ▶ | next if $keyname eq 'elementnamespace'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 958 | 0 | ▶ | next if $keyname =~ /^xmlns/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 959 | 0 | my $value = $element->{$keyname}; | |||||||||||||||||||||||||||
| 960 | 0 | ▶ | if(ref($value)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 961 | # this is an element array | ||||||||||||||||||||||||||||
| 962 | 0 | ▶ | $candelete = 0 if !$self->_delete_if_empty($element, $keyname); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 963 | } else { | ||||||||||||||||||||||||||||
| 964 | # we have a none-namespace attribute | ||||||||||||||||||||||||||||
| 965 | 0 | $candelete = 0; | |||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||
| 970 | 0 | ▶ | delete($ref->{$refname}) if $candelete; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 971 | 0 | return $candelete; | |||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | 0 | ▶ | sub _compress_schema { | ||||||||||||||||||||||||||
|
Subroutine
_compress_schema: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 975 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 976 | 0 | my $ref = $self->refhash; | |||||||||||||||||||||||||||
| 977 | 0 | $self->_compress_element_reference($ref); | |||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||
| 980 | 0 | ▶ | sub _compress_element_reference { | ||||||||||||||||||||||||||
|
Subroutine
_compress_element_reference: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||
| 981 | 0 | my($self, $hashref) = @_; | |||||||||||||||||||||||||||
| 982 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||
| 984 | 0 | my @attributes; | |||||||||||||||||||||||||||
| 985 | my @elements; | ||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||
| 987 | 0 | for my $keyname ( sort keys(%$hashref) ) { | |||||||||||||||||||||||||||
| 988 | 0 | my $value = $hashref->{$keyname}; | |||||||||||||||||||||||||||
| 989 | 0 | ▶ | if(ref($value)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 990 | 0 | push(@elements, $keyname); | |||||||||||||||||||||||||||
| 991 | } else { | ||||||||||||||||||||||||||||
| 992 | 0 | push(@attributes, $keyname); | |||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||
| 996 | 0 | for my $keyname ( @attributes ) { | |||||||||||||||||||||||||||
| 997 | #next if $keyname eq 'elementnamespace'; # - should never appear | ||||||||||||||||||||||||||||
| 998 | 0 | my $value = $hashref->{$keyname}; | |||||||||||||||||||||||||||
| 999 | 0 | ▶ | if($keyname =~ /^xmlns:(.+)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1000 | # this is a namespace declaration | ||||||||||||||||||||||||||||
| 1001 | # record it in the current schema | ||||||||||||||||||||||||||||
| 1002 | # and delete it from the record | ||||||||||||||||||||||||||||
| 1003 | 0 | my $replacerequired = 0; | |||||||||||||||||||||||||||
| 1004 | 0 | my $namespacesname = $1; | |||||||||||||||||||||||||||
| 1005 | 0 | ▶ | if(exists($schema->{namespace}->{$value})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1006 | # namespace exists | ||||||||||||||||||||||||||||
| 1007 | 0 | my $alias = $schema->{namespace}->{$value}; | |||||||||||||||||||||||||||
| 1008 | 0 | ▶ | if($namespacesname ne $alias) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1009 | 0 | $schema->{nstranslation}->{$namespacesname} = $alias; | |||||||||||||||||||||||||||
| 1010 | 0 | $namespacesname = $alias; | |||||||||||||||||||||||||||
| 1011 | 0 | $replacerequired = 1; | |||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||
| 1013 | } else { | ||||||||||||||||||||||||||||
| 1014 | # make sure namespace name is unique before adding values | ||||||||||||||||||||||||||||
| 1015 | 0 | ▶ | while(exists($schema->{nstranslation}->{$namespacesname})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1016 | 0 | $namespacesname .= 'n'; | |||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||
| 1018 | 0 | $schema->{namespace}->{$value} = $namespacesname; | |||||||||||||||||||||||||||
| 1019 | 0 | $schema->{nstranslation}->{$namespacesname} = $namespacesname; | |||||||||||||||||||||||||||
| 1020 | 0 | $replacerequired = 1; | |||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||
| 1022 | # delete the declaration | ||||||||||||||||||||||||||||
| 1023 | 0 | delete($hashref->{$keyname}); | |||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||
| 1027 | 0 | for my $keyname ( @elements ) { | |||||||||||||||||||||||||||
| 1028 | 0 | my $value = $hashref->{$keyname}; | |||||||||||||||||||||||||||
| 1029 | 0 | ▶ | if($keyname =~ /^(.+):(.+)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1030 | # element has a namespace | ||||||||||||||||||||||||||||
| 1031 | 0 | my $namespace = $1; | |||||||||||||||||||||||||||
| 1032 | 0 | my $shortname = $2; | |||||||||||||||||||||||||||
| 1033 | 0 | ▶ | my $nsalias = $schema->{nstranslation}->{$namespace} || $namespace; | ||||||||||||||||||||||||||
|
Condition0%0/3
$schema->{'nstranslation'}{$namespace} || $namespace
MC/DC0%0/2
$schema->{'nstranslation'}{$namespace} || $namespace
$schema->{'nstranslation'}{$namespace}
$namespace
Truth table0%0/3
A || B
A= $schema->{'nstranslation'}{$namespace}B= $namespace
| |||||||||||||||||||||||||||||
| 1034 | 0 | $hashref->{$shortname} = $value; | |||||||||||||||||||||||||||
| 1035 | 0 | delete($hashref->{$keyname}); | |||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||
| 1037 | 0 | $_->{elementnamespace} = $nsalias for( @$value ); | |||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||
| 1040 | 0 | $self->_compress_element_reference($_) for ( @$value ); | |||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | sub _expand_schema { | ||||||||||||||||||||||||||
|
Subroutine
_expand_schema: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 1045 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1046 | 0 | $self->{parser}->{namespaces} = {}; | |||||||||||||||||||||||||||
| 1047 | 0 | my $ref = $self->refhash; | |||||||||||||||||||||||||||
| 1048 | 0 | $self->_expand_element_reference($ref); | |||||||||||||||||||||||||||
| 1049 | # add namespace keys to | ||||||||||||||||||||||||||||
| 1050 | 0 | my $assembly = $ref->{assembly}->[0]; | |||||||||||||||||||||||||||
| 1051 | 0 | ▶ | if($assembly) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1052 | 0 | foreach my $key (sort keys(%{ $self->{parser}->{namespaces} })) { | |||||||||||||||||||||||||||
| 1053 | 0 | my $xmlns = $self->{parser}->{namespaces}->{$key}; | |||||||||||||||||||||||||||
| 1054 | 0 | my $xmlnsname = qq(xmlns:$key); | |||||||||||||||||||||||||||
| 1055 | 0 | $assembly->{$xmlnsname} = $xmlns; | |||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||
| 1058 | 0 | $self->{parser}->{namespaces} = {}; | |||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||
| 1061 | 0 | ▶ | sub _expand_element_reference { | ||||||||||||||||||||||||||
|
Subroutine
_expand_element_reference: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 1062 | # prepend saved namespace prefixes to elements | ||||||||||||||||||||||||||||
| 1063 | 0 | my($self, $hashref) = @_; | |||||||||||||||||||||||||||
| 1064 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 1065 | 0 | my @keynames = ( sort keys(%$hashref) ); | |||||||||||||||||||||||||||
| 1066 | 0 | for my $keyname ( @keynames ) { | |||||||||||||||||||||||||||
| 1067 | 0 | my $value = $hashref->{$keyname}; | |||||||||||||||||||||||||||
| 1068 | 0 | ▶ | if(ref($value)) { # an array | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1069 | # get namespace if any | ||||||||||||||||||||||||||||
| 1070 | 0 | my $namespace = undef; | |||||||||||||||||||||||||||
| 1071 | 0 | for my $element(@$value) { | |||||||||||||||||||||||||||
| 1072 | 0 | ▶ | if(exists($element->{elementnamespace})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1073 | 0 | $namespace = $element->{elementnamespace}; | |||||||||||||||||||||||||||
| 1074 | 0 | delete($element->{elementnamespace}); | |||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||
| 1077 | 0 | ▶ | if($namespace) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1078 | 0 | my $newname = qq($namespace:$keyname); | |||||||||||||||||||||||||||
| 1079 | 0 | $hashref->{$newname} = $value; | |||||||||||||||||||||||||||
| 1080 | 0 | delete($hashref->{$keyname}); | |||||||||||||||||||||||||||
| 1081 | 0 | my $xmlns = $schema->{namespacelookup}->{$namespace}; | |||||||||||||||||||||||||||
| 1082 | 0 | $self->{parser}->{namespaces}->{$namespace} = $xmlns; | |||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||
| 1084 | 0 | $self->_expand_element_reference($_) for ( @$value ); | |||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||
| 1089 | 0 | ▶ | sub validate_data { | ||||||||||||||||||||||||||
|
Subroutine
validate_data: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1090 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 1091 | # top level element must be assembly | ||||||||||||||||||||||||||||
| 1092 | # grab that and validate onwards | ||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||
| 1094 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 1095 | 0 | my $ref = $self->refhash; | |||||||||||||||||||||||||||
| 1096 | 0 | my @levels = sort keys(%$ref); | |||||||||||||||||||||||||||
| 1097 | 0 | ▶ | croak('Too many top level elements : ' . join(', ', @levels)) if (scalar(@levels) != 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | croak(qq(Unexpected top level element $levels[0])) if $levels[0] ne 'assembly'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||
| 1100 | 0 | my $elementname = 'assembly'; | |||||||||||||||||||||||||||
| 1101 | 0 | ▶ | my $elementdef = exists($schema->{elementtypes}->{$elementname}) ? $schema->{elementtypes}->{$elementname} : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1102 | 0 | ▶ | croak(qq(no definition found for element type $elementname)) if !defined($elementdef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1103 | 0 | my $min = 1; | |||||||||||||||||||||||||||
| 1104 | 0 | my $max = 1; | |||||||||||||||||||||||||||
| 1105 | 0 | my $raw = $ref->{assembly}; | |||||||||||||||||||||||||||
| 1106 | 0 | $self->validate_element_array('assembly', $min, $max, $raw); | |||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | sub validate_element_array { | ||||||||||||||||||||||||||
|
Subroutine
validate_element_array: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1110 | 0 | my($self, $elementname, $min, $max, $ref) = @_; | |||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||
| 1112 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 1113 | 0 | my $elementvaluename = $self->default_content; | |||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||
| 1115 | # get element definition | ||||||||||||||||||||||||||||
| 1116 | 0 | ▶ | my $elementdef = exists($schema->{elementtypes}->{$elementname}) ? $schema->{elementtypes}->{$elementname} : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | croak(qq(no definition found for element type $elementname)) if !defined($elementdef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||
| 1119 | # check if this manifest type accepts element type | ||||||||||||||||||||||||||||
| 1120 | 0 | my $currenttype = $self->get_manifest_type; | |||||||||||||||||||||||||||
| 1121 | 0 | my $exclusive = $elementdef->{exclusive}; | |||||||||||||||||||||||||||
| 1122 | 0 | ▶ | if(($exclusive ne 'none') && ($currenttype ne $exclusive)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$exclusive ne "none" and $currenttype ne $exclusive
MC/DC0%0/2
$exclusive ne "none" and $currenttype ne $exclusive
$exclusive ne "none"
$currenttype ne $exclusive
Truth table0%0/3
A and B
A= $exclusive ne "none"B= $currenttype ne $exclusive
| |||||||||||||||||||||||||||||
| 1123 | 0 | croak(qq(element type $elementname cannot appear in $currenttype manifests)); | |||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||
| 1126 | # check that numbers are OK | ||||||||||||||||||||||||||||
| 1127 | 0 | my $numelements = scalar @$ref; | |||||||||||||||||||||||||||
| 1128 | 0 | ▶ | croak (qq(not enough $elementname elements - count = $numelements - minimum = $min)) if(($min > 0) && ($numelements < $min)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$min > 0 and $numelements < $min
MC/DC0%0/2
$min > 0 and $numelements < $min
$min > 0
$numelements < $min
Truth table0%0/3
A and B
A= $min > 0B= $numelements < $min
| |||||||||||||||||||||||||||||
| 1129 | 0 | ▶ | croak (qq(too many $elementname elements - count = $numelements - maximum = $max)) if(($max > 0) && ($numelements > $max)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$max > 0 and $numelements > $max
MC/DC0%0/2
$max > 0 and $numelements > $max
$max > 0
$numelements > $max
Truth table0%0/3
A and B
A= $max > 0B= $numelements > $max
| |||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||
| 1131 | # validate each element item | ||||||||||||||||||||||||||||
| 1132 | 0 | $self->validate_element($elementname, $elementdef, $_) for (@$ref); | |||||||||||||||||||||||||||
| 1133 | } | ||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||
| 1135 | 0 | ▶ | sub validate_element { | ||||||||||||||||||||||||||
|
Subroutine
validate_element: not called CC=23 SCAR=63.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1136 | 0 | my($self, $ename, $elementdef, $ref) = @_; | |||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||
| 1138 | # ref contains elements, and attributes | ||||||||||||||||||||||||||||
| 1139 | # any value is present as attribute 'elementvalue' | ||||||||||||||||||||||||||||
| 1140 | # elements are arrayrefs | ||||||||||||||||||||||||||||
| 1141 | # attributes are values | ||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||
| 1143 | 0 | my $schema = $self->get_current_schema; | |||||||||||||||||||||||||||
| 1144 | 0 | my $elementvaluename = $self->default_content; | |||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||
| 1146 | 0 | my @keynames = (sort keys(%$ref)); | |||||||||||||||||||||||||||
| 1147 | 0 | my %elementnames = (); | |||||||||||||||||||||||||||
| 1148 | 0 | my %attributenames = (); | |||||||||||||||||||||||||||
| 1149 | 0 | my $valuepresent = 0; | |||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||
| 1151 | 0 | for my $kname(@keynames) { | |||||||||||||||||||||||||||
| 1152 | 0 | ▶ | next if $kname eq 'elementnamespace'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1153 | 0 | ▶ | if( $kname eq $elementvaluename ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 1154 | 0 | $valuepresent = 1; | |||||||||||||||||||||||||||
| 1155 | } elsif(ref($ref->{$kname})) { | ||||||||||||||||||||||||||||
| 1156 | 0 | ▶ | if(not exists($elementdef->{elements}->{$kname})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1157 | 0 | croak(qq(Unexpected element $kname in $ename)); | |||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||
| 1159 | 0 | $elementnames{$kname} = 1; | |||||||||||||||||||||||||||
| 1160 | } else { | ||||||||||||||||||||||||||||
| 1161 | # allow no value namespace attributes to pass | ||||||||||||||||||||||||||||
| 1162 | 0 | ▶ | next if $kname =~ /^xmlns:.+$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1163 | 0 | ▶ | next if $kname eq 'xmlns'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | if(not exists($elementdef->{attributes}->{$kname})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1165 | 0 | croak(qq(Unexpected attribute $kname in $ename)); | |||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||
| 1167 | 0 | $attributenames{$kname} = 1; | |||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||
| 1171 | # check we have all required elements | ||||||||||||||||||||||||||||
| 1172 | 0 | foreach my $ekey (sort keys(%{ $elementdef->{elements} })) { | |||||||||||||||||||||||||||
| 1173 | 0 | ▶ | if( $elementdef->{elements}->{$ekey}->{min} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1174 | 0 | ▶ | croak qq(required element $ekey not found) if !exists($elementnames{$ekey}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1175 | } | ||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||
| 1177 | # check we have all required attributes | ||||||||||||||||||||||||||||
| 1178 | 0 | foreach my $akey (sort keys(%{ $elementdef->{attributes} })) { | |||||||||||||||||||||||||||
| 1179 | 0 | ▶ | next if $akey eq 'xmlns'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1180 | 0 | ▶ | if( $elementdef->{attributes}->{$akey}->{required} == 1 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1181 | 0 | ▶ | croak qq(required attribute $akey not found) if !exists($attributenames{$akey}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||
| 1184 | # check we have correct value / novalue | ||||||||||||||||||||||||||||
| 1185 | 0 | my $valuerequired = $elementdef->{content}->{value}; | |||||||||||||||||||||||||||
| 1186 | 0 | ▶ | if($valuerequired != $valuepresent) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1187 | 0 | croak qq( unexpected value in $ename - value required = $valuerequired : value present = $valuepresent); | |||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||
| 1190 | # validate any value | ||||||||||||||||||||||||||||
| 1191 | 0 | ▶ | if($valuerequired) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1192 | 0 | my $validator = $elementdef->{value_validator}; | |||||||||||||||||||||||||||
| 1193 | 0 | ▶ | Win32::Exe::Manifest::Parser->$validator($ref->{$elementvaluename}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1194 | or croak(qq(Invalid Value $ref->{$elementvaluename} for element $ename)); | ||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||
| 1197 | # validate attributes | ||||||||||||||||||||||||||||
| 1198 | 0 | foreach my $aname (sort keys( %attributenames ) ) { | |||||||||||||||||||||||||||
| 1199 | 0 | ▶ | next if $aname eq 'xmlns'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1200 | 0 | my $avalue = $ref->{$aname}; | |||||||||||||||||||||||||||
| 1201 | 0 | my $validator = $schema->{attributes}->{$aname}; | |||||||||||||||||||||||||||
| 1202 | 0 | ▶ | Win32::Exe::Manifest::Parser->$validator($avalue) or croak(qq(Invalid value $avalue for attribute $aname in $ename)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||
| 1205 | # validate elements | ||||||||||||||||||||||||||||
| 1206 | 0 | foreach my $sub_ename (sort keys( %elementnames ) ) { | |||||||||||||||||||||||||||
| 1207 | 0 | my $elearryref = $ref->{$sub_ename}; | |||||||||||||||||||||||||||
| 1208 | 0 | my $min = $elementdef->{elements}->{$sub_ename}->{min}; | |||||||||||||||||||||||||||
| 1209 | 0 | my $max = $elementdef->{elements}->{$sub_ename}->{max}; | |||||||||||||||||||||||||||
| 1210 | 0 | $self->validate_element_array($sub_ename, $min, $max, $elearryref); | |||||||||||||||||||||||||||
| 1211 | } | ||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||
| 1214 | 0 | ▶ | sub get_dependency_template { | ||||||||||||||||||||||||||
|
Subroutine
get_dependency_template: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1215 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||
| 1216 | 0 | my $dependencytemplates = $self->get_dependency_template_hash; | |||||||||||||||||||||||||||
| 1217 | 0 | ▶ | if(exists($dependencytemplates->{$name})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1218 | 0 | return $dependencytemplates->{$name}; | |||||||||||||||||||||||||||
| 1219 | } else { | ||||||||||||||||||||||||||||
| 1220 | 0 | return undef; | |||||||||||||||||||||||||||
| 1221 | } | ||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||
| 1224 | 0 | ▶ | sub get_dependency_template_hash { | ||||||||||||||||||||||||||
|
Subroutine
get_dependency_template_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1225 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 1226 | 0 | my $dependencytemplates = { | |||||||||||||||||||||||||||
| 1227 | 'Microsoft.Windows.Common-Controls' => { | ||||||||||||||||||||||||||||
| 1228 | name => 'Microsoft.Windows.Common-Controls', | ||||||||||||||||||||||||||||
| 1229 | type => 'win32', | ||||||||||||||||||||||||||||
| 1230 | version => '6.0.0.0', | ||||||||||||||||||||||||||||
| 1231 | publicKeyToken => '6595b64144ccf1df', | ||||||||||||||||||||||||||||
| 1232 | language => '*', | ||||||||||||||||||||||||||||
| 1233 | processorArchitecture => '*', | ||||||||||||||||||||||||||||
| 1234 | }, | ||||||||||||||||||||||||||||
| 1235 | }; | ||||||||||||||||||||||||||||
| 1236 | 0 | return $dependencytemplates; | |||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | sub get_default_manifest { Win32::Exe::Manifest::Parser->get_default_manifest(); } | ||||||||||||||||||||||||||
|
Subroutine
get_default_manifest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||
| 1241 | 3 | ▶ | sub get_default_schema { Win32::Exe::Manifest::Parser->get_default_schema(); } | ||||||||||||||||||||||||||
|
Subroutine
get_default_schema: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||
| 1243 | |||||||||||||||||||||||||||||
| 1244 | 5 | 1; | |||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||
| 1246 | __END__ | ||||||||||||||||||||||||||||