On 2011.11.15 1:01 AM, Buddy Burden wrote:
> I did not know this ... just to be super-clear, obviously I know that
> if I have script.pl and it starts with
>
> #! /usr/bin/perl -w
>
> and I make it executable and run it directly, I get perl -w. But
> you're saying that even if I type:
>
> perl script.pl
>
> I _still_ get perl -w? That, I was not aware of.
Yep.
Now, want to have your mind blown?
$ cat ~/tmp/test
#!/usr/bin/python
def hello():
print "Hello world!"
return
hello();
$ python ~/tmp/test
Hello world!
$ perl ~/tmp/test
Hello world!
>> Adding -w to the #! line on your tests is a very good idea to avoid the
>> gotcha of differences between a test being run with `prove` (does not set
>> -w), ...
>
> Well, yes, prove doesn't _normally_ set -w, but if you run prove -w,
> it does, doesn't it?
Yes.
If you don't set it in #! you, or somebody else, will forget to pass -w to
prove and then you'll spent a bunch of time scratching your head wondering why
the test is running differently from in "make test".
--
Just call me 'Moron Sugar'.
http://www.somethingpositive.net/sp05182002.shtml