Yet for some reason, indirect new calls have found their way into the documentation of many, many CPAN modules.Indeed, and that's very unfortunate. Let me try to give an explaination (I don't know whether that's the explaination, it's more a theory of mine):
In the early years of perl5, new Module @args was the recommended way of calling a constructor. It's shorter than Module -> new (@args), and it's what C++ and some other languages use. So, CPAN modules, and also modules coming with perl5, used this syntax, and so did the main documentation.
It wasn't that after a few years (1997 I think) that people like Tom and Mark-Jason noticed the potential problems, and started warning against its use. The documentation got updates, but there was still quite some code/documentation using the indirect object syntax out there. Which invites people to copy it when they write new syntax. So there has always been a large amount of module on CPAN using the indirect object syntax - and it has enough critical mass to make some new authors use this as well.
Also, the problems with the indirect object syntax is infrequent enough that many people will never run into problems with indirect objects, even if they use it daily. How venerable you are to get bitten by the indirect object syntax also depends on your way of coding.
There seems to be a persistent belief that new is a keyword.
It's not, but sometimes I wonder whether it would have been better if it was.
In reply to Re^3: Why you shouldn't use the Indirect notation with AUTOLOAD
by Anonymous Monk
in thread Why you shouldn't use the Indirect notation with AUTOLOAD
by dragonchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |