Solved mystery – perl on XAMPP won’t run modified scripts “End of script output before headers”
Friday 4 April 2014 @ 10:20 am

Nice, WTFish riddle for You today. Imagine this – there is a XAMPP server – Windows, apache, Perl and PHP (from www.apachefriends.org) installed on your laptop.

I hope the previous sentence did not put you off, linux fans 😉

Still with me?  Read on: you have a typical hello world type perl script, serving as an example and test, that is delivered with that whole bunch.

It works. Shows “OK” via CGI.


#!"C:\xampp\perl\bin\perl.exe" 
 
print "Content-Type: text/html\n\n"; 
print "OK";

You write your own small script – get server error 500 – “End of script output before headers“.

You put your script in the same directory as that example – still get 500.

You copy your example script to other file in the same directory and edit it – 500.

You copy your example script to other file in the same directory and NOT edit it this time  – 500.

You edit your example script (that original file) , do the slightest change – for example change string to “OK2”  – 500.

You edit your example script back to be exactly as it was before – it works.

WTF?

Good text editor was used – Notepad++ (saving as UTF8 without BOM, line endings were not messed with), so it was not the cause of problems.

The problem was encountered by more than one person (1st, 2nd).

Guess where the problem was.

You can think for yourself, the answer to the riddle, cause and solution is below (scroll if you have no idea)

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.

 

 

 

 

 

 

 

 

 

 

.

 

 

 

The antivirus/firewall program, COMODO Internet Security was causing the problem. It did not allow to run neither new perl files, nor modified existing perl files. I guess it somehow accepted the original file that was created during XAMPP installation, but when someone tried to modify it or make new one – it won’t run.

Solution – temporarily turn off sandbox feature or the whole COMODO antivirus/firewall at all. Or change it to other product.

Comments (1) - Posted in wtf by  



Perl Ironman – what is going on?
Wednesday 24 March 2010 @ 6:40 am

Did someone forgot about perl ironman competition and neglects it?

See http://jquelin.blogspot.com/2010/02/ironman-challenge-status.html and http://www.lowlevelmanager.com/2010/01/perl-iron-man-challenge-is-cron-still.html

wtf?

Comments (1) - Posted in wtf by  



My presentation at YAPC::EU::2009 was graded
Wednesday 4 November 2009 @ 6:54 am

I received feedback from conference attendees about my presentation at YAPC::EU. And it was very good 🙂

After the conference attendees are encouraged to express their opinions on presentations they attended and grade them. Then the aggregated grades and opinions are sent to speaker.

I was a bit nervous, but fortunately presentation about WTFish side of using Perl was graded between 7 and 10 (on a scale from 1 to 10), mostly 8-9.

There were also opinions – good and bad.

Bad: I could have been speaking louder and with better intonation and gestures. Slides also could be a bit better. Someone even wrote “Poor guy, it is hard to present in another language. I hope he isnt disheartened, his presentation is good” 🙂

Good opinions (quoted from the feedback I got):

Poor guy, it is hard to present in another language.	I hope he isnt
  disheartened, his presentation is good

Thanks for good opinions 🙂 and also for bad – those taught me something about presentations. Next time it will be better 🙂

Comments (1) - Posted in yapc by  



Perl 5.10.1
Wednesday 14 October 2009 @ 6:52 am

Well, the perl 5.10.1 was released some time ago. It includes some nice features and some strange features.
I’m osting it in “future” category, as I do not intend to use it now. Neither 5.10. Why? It is being changed, and I like language I develop in to be more constant  🙂

Nice:

Strange:

Comments (0) - Posted in future by  



Having nice background colors in Spreadsheet::WriteExcel
Wednesday 7 October 2009 @ 10:03 am

If you want to make Excel spreadsheet using perl module Spreadsheet::WriteExcel with, for example, orange or yellow backgorund in some cells, you can use the built-in palette, but the colours there may burn your eyes 🙂

How to have nice colours in spreadsheets: use set_custom_color($index, $red, $green, $blue)

For example:

my $light_orange = $workbook->set_custom_color(43, 255, 226, 171);
my $ligth_yellow = $workbook->set_custom_color(42, 255, 255, 204);
my $light_purple = $workbook->set_custom_color(40, 225, 204, 255);

Comments (0) - Posted in work by  



Perl – why not popular
Wednesday 30 September 2009 @ 6:53 am

My wife asked me: why did you choose perl? I told her that it is easy and robust, allows quick development, effective writing scripts that will be used just one time etc. To back it, I  gave a few examples: when you want to sort, you just use sort, no need to implementing it. When you wat to open file, you just open file. And those regexps – are awesome great.

Then, my wife asked me another question – ok, if it is so great, why do so few people and companies write in it?

This was question I couldn’t find answer for. I told her about that is not so easy to make .exe file from perl script, but as I heard strawberry perl is good in doing it. Or PAR. I’ll have to look closely at them both in near future. Anyway, in C/C++ it is the most natural way to run the program – to make executable of it 🙂 In Perl it is not the natural way. And some companies prefer to have executable files, for example to sell them 🙂

Anyway, that is good question: Why Perl is not so popular as C-something, or java?

Comments (4) - Posted in future by  



Advertise Perl with Gabor
Wednesday 23 September 2009 @ 6:42 am

Gabor Szabo made a perl ad server, you can display ads to advertise Perl on your website (as I do – you can see  them on the right sidebar, if you do not – turn off adblock 🙂 ).

To install this,  read more…

Comments (0) - Posted in future by  



Working as perl developer – telecommuting
Wednesday 16 September 2009 @ 6:55 am

Wow,this would be four weeks  since joining ironman challenge.

Recently I was wondering about pros and cons of working as Perl developer in two ways:

1) In office, in a big company

2) by telecommuting or other way working in other place that the employer is

They have both advantages and disadvantages.

In office, advantages are: nice colleagues (I am lucky to have them now), free coffe and tea and milk and sugar and…, constant daily routine, a bit of fun/laughing/relax everyday (face it, noone works 100% of the time – it would be also bad for their creativity, physical and mental health etc – for example we are advise to stop looking at minitor every hour for about 5 minutes), fixed hours with some flexibility. Disadvantages: daily commute, trafic jams, earnings based on world region/country, even city.

Telecommute: higher earnings, possiblity to geoarbitrage (I mean earning in one country, living in another – cheaper, or even constantly travel – for more ideas on this see: 4HWW ), no commute, no traffic jams. Disadvantages: I assume you are paid on results – so if you screw up, you have free work overtime. No colleagues, no free coffe nor tea. Your home is your work – that is not good. Unless you rent some office space or use shared working place. Hard to say more, I never worked like this.

What do you think?

Comments (3) - Posted in work by  



More on foreach localisation
Wednesday 9 September 2009 @ 6:47 am

This was first time I encountered the strange foreach localisation.

One day I was using global var in script (lame, I know). I wanted to use it in foreach. And its value magically disappeared when called other subroutine. This was strange.

This was a script to make reports for customers. The code looked like this (many parts taken out for brevity and to protect the innocent 😉 ) :

read more…

Comments (1) - Posted in wtf by  



Perl is dead – or is it not?
Wednesday 2 September 2009 @ 6:46 am

During the YAPC::EU 2009 conference in Lisbon, I heard many times that Perl is NOT dead. Interesting, I never considered Perl to be dead. It is funy thing about human brain, it skips the word NOT. So the message I got is: perl is dead. If so many people try to convince me that “perl is NOT dead”, there has to be a good reason that other people think it IS dead. What can this reason be? Old beliefs about perl? Rise of new languages like python, ruby, groovy?

And, more important for myself – what should I do?

There are several things:

What do YOU think about it?

Comments (3) - Posted in future by  



Older Posts »