in reply to Re: Fix ActiveState Script Maps (IIS)
in thread Fix ActiveState Script Maps (IIS)

Do a view source on the page and look at the html. Some nice person has inserted
<font color="red"><b><u>&shy;</u></b></font>
in the HTML. D'oh!

Replies are listed 'Best First'.
Here is a fixed version -- just watch for line wraps :-|
by Anonymous Monk on Apr 25, 2004 at 17:53 UTC
    # 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;
      when ruuning the (fixed) version, it aborts on line 3: use strict; Syntax error "use" not allowd in expression. Appreciate any suggestion. tia
      When I ran the fixed version, it aborted at line 3: use strict; Syntax error "use" not allowed in expression. Appreciate any suggestions. tia
      When i try to run this script i receive the following error "use" not allowed expression.