# MDSN: http://msdn.microsoft.com/library/en-us/iisref/html/psdk/asp/a +pro9tkj.asp use strict; use warnings; use Win32::OLE qw(in); # Connect to IIS on the Local Machine with ADSI... my $iis_web_object = Win32::OLE->GetObject("IIS://LocalHost/W3SVC") or die "Can't access IIS on the local machine\n"; my ($perl_path) = $^X =~ /(.*)\\[^\\]+$/; my $iis_verbs = ((Win32::GetOSVersion)[1] == 5) ? 'GET,HEAD,POST' : 'P +UT,DELETE'; foreach my $path (in $iis_web_object->GetDataPaths("ScriptMaps", 0)) { my $node = Win32::OLE->GetObject($path); print "Setting $path...\n"; my $str_maps = $node->{ScriptMaps}; my %script_maps; foreach (in @$str_maps) { my ($ext, $exe, $script, $verbs) = split /,/, $_, 4; $script_maps{$ext} = { exe => $exe, script => $script, verbs=> $ve +rbs} } $script_maps{'.pl'} = $script_maps{'.pm'} = $script_maps{'.cgi'} = { exe => $^X.' "%s" %s', script=> 1, verbs=> $iis_verbs }; $script_maps{'.plx'} = { exe => $perl_path."\\perlIS.dll", script=> 1, verbs=> $iis_verbs +}; my $new_maps = []; foreach (sort keys %script_maps) { push @$new_maps, join ',', $_ , $script_maps{$_}->{exe} , $script_maps{$_}->{script} , $script_maps{$_}->{verbs} } $node->{ScriptMaps} = $new_maps; $node->SetInfo(); } undef $iis_web_object;
In reply to Here is a fixed version -- just watch for line wraps :-|
by Anonymous Monk
in thread Fix ActiveState Script Maps (IIS)
by $code or die
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |