Solved

Script not working on 2003 server

Posted on 2004-10-07
17
204 Views
Last Modified: 2012-06-21
Hello,
I have a script that works just fine on Windows 2000, but the exact same script on 2003 is giving me errors.  For testing purposes, I am running it command line.  When it's on 2000 server, command line works fine.  When run on 2003 Server, this is the message I get:

Too late for "-T" option at contact.pl line 1.

The first few lines of code are:

#!d:\perl\bin\perl.exe
#
# NMS FormMail Version 3.11c1
#

I searched through the code, and there is no "-T" anywhere in the code.

This error only happens with the one particular perl script, everything else works fine.  Any suggestions would be helpful.
0
Comment
Question by:gexen
  • 6
  • 5
  • 2
  • +2
17 Comments
 
LVL 20

Expert Comment

by:jmcg
Comment Utility
That's a bit odd. Try running it from the command line by giving the -T option explicitly:

perl -Tw contact.pl

(using whatever path is appropriate for contact.pl).

And perhaps you should check to see whether the content of d:\perl\bin\perl.exe is really a shell script that attempts to supply flags while running the Perl interpreter from another path.
0
 
LVL 13

Expert Comment

by:gripe
Comment Utility
From perldoc perldiag:

Too late for "-T" option
    (X) The #! line (or local equivalent) in a Perl script contains the
    -T option, but Perl was not invoked with -T in its command line.
    This is an error because, by the time Perl discovers a -T in a
    script, it's too late to properly taint everything from the
    environment. So Perl gives up.

    If the Perl script is being executed as a command using the #!
    mechanism (or its local equivalent), this error can usually be fixed
    by editing the #! line so that the -T option is a part of Perl's
    first argument: e.g. change "perl -n -T" to "perl -T -n".

    If the Perl script is being executed as "perl scriptname", then the
    -T option must appear on the command line: "perl -T scriptname".

Hope this helps.
0
 
LVL 1

Author Comment

by:gexen
Comment Utility
Unfortunately, the -T option doesn't seem to work.  While it does get rid of the error message, it outputs nothing.  Any ideas?
0
 
LVL 13

Expert Comment

by:gripe
Comment Utility
Are you using the compact or the modular NMS formmail package?
0
 
LVL 13

Expert Comment

by:gripe
Comment Utility
Also.. versions?
0
 
LVL 1

Author Comment

by:gexen
Comment Utility
#!d:\perl\bin\perl.exe -T
#
# NMS FormMail Version 3.11c1
#

How can I tell if it's the compact or modular?

Perl version is 5.8.0
0
 
LVL 13

Expert Comment

by:gripe
Comment Utility
The modular version will be packaged with a libs directory with .pm modules down in there somewhere.

Are you absolutely positive that you've removed the -T option from the shebang line (the first line starting with #!)?

The second paste you made above still shows this argument. It would be very odd for perl to generate this error if the -T option is absent from the shebang line.

You might also try upgrading to the newest version of NMS FormMail. The newest is v3.14c1. I don't think this is the solution to your problem though.

Are you sure you're not looking at the original (working) Win2K terminal window rather than the Win2K3 one? :) :) :)
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:gexen
Comment Utility
Hello,
I just added the -T to the shebang line, when it was giving that error in the first place, it was never even there, which was why I thought was weird!  I added it as per

"If the Perl script is being executed as "perl scriptname", then the -T option must appear on the command line: "perl -T scriptname".

I thought maybe I had to add it to the shebang line.



0
 
LVL 13

Expert Comment

by:gripe
Comment Utility
I'm not sure if I understand.. is it now working as expected? Please restate your problem.
0
 
LVL 1

Author Comment

by:gexen
Comment Utility
No, it's not working.  When I run the script through the command line, with the -T option, it doesn't output anything.  If I run it without the -T, the error is

Too late for "-T" option at contact.pl line 1.

even though there is no -T specified anywhere.

I'm just running it through command line for testing purposes, obviously the end result will be that it works over the internet.

If you run this command-line on the 2000 machine, it writes out an HTML page about how it doesn't have the necessary variables.  On the 2003, when using the -T flag, it writes out nothing.
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
In so far as I remember (and I could be wrong), FormMail won't output anything if it hasn't received any data, so that should be normal behaviour.
0
 
LVL 1

Author Comment

by:gexen
Comment Utility
Well,
If I run it on the command line in 2000, it outputs what looks like an error generated by IIS, as it has DTD for XML or XHTML along with the error, so I think you may be right.  I think there is an application possibly installed on the 2000 server that is helping to generate that message.

Before I got here, I briefly remember someone mentioning an application that may have something to do with the problem I am experiencing.    I forget what it was called though...bochs...locks...something like that.  Anybody have any idea what I'm talking about?

If it's running fine through the command line, then my problem is now that whenever anybody tries to load it through the web, we get this error message, even though all other perl scripts are working:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.



0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
Have you left the -T on the she bang line?

If so, just remove it.
0
 
LVL 1

Author Comment

by:gexen
Comment Utility
It's the same error either way, except without the -t, I am unable to execute it in the command line.
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video discusses moving either the default database or any database to a new volume.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now