Home: Need a Custom or Prewritten Perl Program?: Throw Down The Gauntlet:
change shebang line automatically



inlimbo
User

Dec 22, 2004, 3:27 AM


Views: 44314
change shebang line automatically

Im sure this is very very very simple to do.

I just want a script whereby i can pass in a cgi file and it checks the first line - i.e. the shebang. If the shebang line is #!/perl/bin/perl change it to #!/usr/bin/perl .

Similarly if Ive got -wT on the end of the shebang line I want it to stay there. Maybe the code could automatically put on -wT and use CGI qw(:standard); and use CGI::Carp qw(warningsToBrowser fatalsToBrowser); and use strict; in case I forget. Yeah that would be ace.

I write and test all my scripts on my home PC running Apache on Winblows XP and the path to perl is #!/perl/bin/perl but the path to perl on my website is #!/usr/bin/perl. Its a little bit annoying when i forget this i get a 500 error and I scream "What the #$*@! ....[calms down] Opps forgot about the shebang" :)

it would be extra way cool if it could automatically FTP the file to a predetermined directory on my web server and chmod it to 755. That would blow my mind.

But all im really after is code for changing the shebang line so that i can attempt (my first attempt at non-web based perl) to make a win32 app using it.

inlimbo... Laugh


kencl
User

Jan 10, 2006, 10:54 PM


Views: 42526
Re: [inlimbo] change shebang line automatically

Why do you even need a shebang line in XP? Try taking it out completely and see if it run without it.

Then just white a script which opens your file(s) and prepends a standard header with whatever you wanted (use strict etc).

>> If you can't control it, improve it, correlate it or disseminate it with PERL, it doesn't exist!


MrPJ
User

Jan 17, 2006, 9:05 AM


Views: 42517
Re: [inlimbo] change shebang line automatically

Install perl into:

/usr/bin

...on your pc instead of /perl/bin


rork
User

Jan 22, 2006, 11:50 AM


Views: 42500
Re: [MrPJ] change shebang line automatically

That's one of the things I didn't like of ActiveState perl, I never find out how to change the directory where it's installed in.

And on windows you probably can use #!/usr/bin/perl as shebang line, it doesn't bother about it anyways.
--
Don't reinvent the wheel, use it, abuse it or hack it.

(This post was edited by rork on Jan 22, 2006, 11:51 AM)


MrPJ
User

Jan 22, 2006, 12:22 PM


Views: 42498
Re: [rork] change shebang line automatically

>>
That's one of the things I didn't like of ActiveState perl, I never find out how to change the directory where it's installed in.
<<

The installer lets you choose.