home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_5f70e6426cf8178e4f22da9cdc7fbc84
< prev
next >
Wrap
Text File
|
2000-03-16
|
1KB
|
41 lines
use Win32::OLE;
my $error = AddFileExtMapping(@ARGV);
print Win32::OLE->LastError if Win32::OLE->LastError;
print "Press [ ENTER ] to continue:"; <STDIN>;
exit($error);
sub AddFileExtMapping {
my $serverID = shift;
my $virtDir = shift;
my $fileExt = shift;
my $execPath = shift;
my $methodExclude = shift;
my $flags = shift;
my $node = "IIS://localhost/W3SVC/$serverID/ROOT";
$node .= "/$virtDir" if length($virtDir) > 0;
# Get the IIsVirtualDir Automation Object
my $server = Win32::OLE->GetObject($node);
# create our new script mapping entry
my $scriptMapping = "$fileExt,$execPath";
$scriptMapping .= ",$methodExclude" if length($methodExclude > 2);
$scriptMapping .= ",$flags";
my @ScriptMaps = @{$server->{ScriptMaps}};
my @NewScriptMaps = map {
/^\Q$fileExt,\E.*/ ? $scriptMapping : $_ } @ScriptMaps;
push(@NewScriptMaps, $scriptMapping)
unless grep {/^\Q$fileExt,\E.*/} @NewScriptMaps;
print join("\n", @NewScriptMaps);
$server->{ScriptMaps} = \@NewScriptMaps;
# Save the new script mappings
$server->SetInfo();
}