Tags:
create new tag
view all tags

SID-00425: Shebang #! and other Windows issues

Status: Answered Answered TWiki version: Perl version:
Category: Server OS: Last update: 16 years ago

I have been having a lot of trouble setting this up on windows. Hopefully, I'm past the hard part. I removed some lines from the configuration file which was generated and I had to change the shebang #! from:

#!/usr/bin/perl -wT

to

#!perl

Apparently you are suppose to be able to make a registry change to solve this problem:

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.cgi] [HKEY_CLASSES_ROOT\.cgi\Shell] [HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI] [HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command] @="C:\\Perl\\bin\\perl.exe -T"

http://www.snetram.nl/?p=37

I tried the above and it didn't do anything. However, I'm using .pl for my perl scripts and not .cgi (does anyone know a way so I don't have to add an extenstion?). Anyway, I suppose I could try adding the same key for .pl but I don't understand exactly what it does and I'm getting frustrated so I'm tempted to just edit all the shebangs instead.

-- JohnCreighton - 2009-07-20

Discussion and Answer

Since the shebangs get overwritten every time you upgrade or patch TWiki, it's worth have a script to do that. TWikiScripts refers to /twiki/tools/rewriteshebang.pl,

Or, save this as "\twiki\bin\shebang", and execute it at the command line with "perl shebang":

#!D:/<perl_path>/perl/bin/perl

#redo the perl shebangs for all scripts

my $twikiBin = 'D:\\<twiki_path>\\twiki\\bin';
opendir(DIR, $twikiBin);
my @files = readdir(DIR);
closedir(DIR);

foreach my $file (@files) {
   next if ( ($file eq '.') || ($file eq '..') || ($file eq 'logos') );
   print "\n fixing shebang on cgi: $file";
   $cmd = 'D:\\<perl_path>\\perl\\bin\\perl -pi~ -e "s/C:\/perl\/bin\/perl/D:\/<perl_path>\/perl\/bin\/perl/" "'.$twikiBin.'\\'.$file.'"';
   `$cmd`;
}

After confirming that the files were converted properly, delete the original files that were backed up with '~'.
(The easiest way to do that is to use Windows Explorer to search on the folder for '~' in the file name, then just select all and delete).

-- SeanCMorgan - 2009-07-20

That's not a bad solution. I read before that you can use the windows registry to create virtual directories (things like, mycomputer or mydocuments). I wonder if we could create /usr/bin/perl as a virtual directory which points to the directory that perl is in.

-- JohnCreighton - 2009-07-21

You can create a mount point (virtual directory) for /usr/bin/perl with Cygwin, if you're using that. Otherwise you'll need a drive letter in the shebang.

But Cygwin is slow. I wouldn't recommend it.

-- SeanCMorgan - 2009-07-21

Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the TWiki consultants if you need timely help. We invite you to get involved with the community, it is more likely you get community support if you support the open source project!

-- PeterThoeny - 2009-09-05

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Shebang #! and other Windows issues
SupportCategory

TWiki version

Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2009-09-05 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.