Perl
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:

  • bug-fixes, optimisations, tuning. Runs faster.
  • autodie pragma :-)

Strange:

  • “..” operator is interpretedin boolean context when used inside a when statement – yet another WTF. So, the behaviour of “..” is not less consistent. On the other hand it may be usefull.
  • Change of smart match behavior in comaprison to 5.10
    1. better encapsulation
    2. ordering matters – $key ~~ %hash is OK, while %hash ~~ $key is not.
    3. distributive – applies itself recursively across data structures.  Isn’t it getting too smart? And too complex to understand in real code? And too WTFish? I’ll quote the fragment of perl tips newsletter from http://perltraining.com.au/

      following expression is *true* when evaluated under 5.10.1, but *false*
      under 5.10.0:

      ‘bar’ ~~ [ 'foo', [ 'bar', 'baz' ], ‘qux’ ]

      In the same vein, given the following code:

      [ 'foo', 'bar', 'baz' ] ~~ \&subroutine

      Perl 5.10.1 will call the subroutine *three* times (once for each
      element), and the whole expression will be considered true if *all* the
      results are true. On the other hand, Perl 5.10.0 would call the
      subroutine only once, passing in the whole data structure.

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:

  • spread the word that perl is great and not dead, by for example joining ironman blogging chalenge
  • wait, and do nothing – if perl is good then it may defend itself without my help
  • learn a new language, to be safe. Or brush up old good java or C-something.

What do YOU think about it?

Comments (3) - Posted in future by  



WTFish side of using Perl talk at YAPC::EU 2009 – slides
Wednesday 26 August 2009 @ 6:52 am

I did my talk about WTF in Perl at YAPC::EU 2009 at Monday, August 3rd. It was a bit stresfull experience for me. Especially that my laptop did not want to show presentation on the projector. I turned out that I do not know my own laptop. Right, I use it rarely. Hopefully presentation was not bad, I received some positive feedback. People were clapping too. Nice :) One person asked me for slides. So here they are:

Feedback about my talk is appreciated, use comment field below :)

Comments (1) - Posted in wtf,yapc by  



Lisbon guide – taxis, traps, virtualtourist
Tuesday 28 July 2009 @ 6:57 am

The YAPC EU in Lisbon is coming. There was a discussion on mailing list about TAXIS in Lisbon.So, here you have some info on a useful site about Lisbon (and about tourism on the whole world):

Taxi warnings:
http://www.virtualtourist.com/travel/Europe/Portugal/Distrito_de_Lisboa/Lisbon-286122/Warnings_or_Dangers-Lisbon-Taxi_rip_offs-BR-1.html

Useful site:
http://www.virtualtourist.com/travel/Europe/Portugal/Distrito_de_Lisboa/Lisbon-286122/TravelGuide-Lisbon.html

Comments (0) - Posted in yapc by  



Perl WTFs – last in function
Monday 27 July 2009 @ 10:17 pm

Imagine you have a loop – and in that loop you call a function (sub) – your, or from some module. And imagine that someone by mistake left there “last” statement. What would it do? it will terminate your loop.

for … {

something…;

function();

something… that would not be executed…

};

sub function {

something something…

last; # by mistake, maybe it should be a “return”?

}

For some people it is a WTF, for some it is very logical way , that it should work like.

What do you think about it?

Comments (0) - Posted in wtf,yapc by  



« Newer PostsOlder Posts »