Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

emazep (6092)

emazep
  (email not shown publicly)

I'm from Roma, Italy and, yes, I'm a male.

Journal of emazep (6092)

Thursday October 26, 2006
09:33 PM

ref never returns undef!

Since I keep on finding here and there tests like this:

if (defined ref $thingy ...

let me point out that ref never returns undef. If its argument is not a reference, ref simply returns the empty string (even if called on undef!)

To have an idea on what I'm talking about (and on how common this redundant - and sometimes completely wrong - test is), have a look at here.
And to have a confirmation that a test like this is really superfluous (at best), have a look at the docs.

Update

Here is a slightly better crafted search - which searches just for the pattern defined\s*\(?\s*ref - which gives more results (though some of them are not pertinent to be honest).

Anyway thank everyone for the clarification about the origin of this meme (though now I have the same n1vux's curiosity ;-)

Ciao, Emanuele.

Wednesday August 03, 2005
06:34 AM

EU plan could put open sourcers in jail

Great!

It's getting better and better day by day!

Emanuele.

Saturday July 30, 2005
04:04 AM

The Stupidest Lawsuit Since the World Began

No, we Europeans aren't any better.
Nay, we're even worse, if possible.

Mala tempora currunt!

Emanuele.

03:56 AM

Microsoft patents the Emoticons

Or at least they try to do it.
I'm sure they will succeed, given the American patent law (sideways swinging on a swing is patented in the Land of Freedom).

O tempora, o mores!

Emanuele.

02:14 AM

"Perl can't create advanced client side applications"?!

I would certainly strongly disagree with a statement like this. But I would disagree even more if, to support such a statement, one gave a reason like this:

True. There are some client side Perl solutions like PerlScript in MSIE 5.0, but all client side Perl requires the user to have the Perl interpreter on their local machine. Most users do not have a Perl interpreter on their local machine. Most Perl programmers who need to create an advanced client side application use Java as their client side programming language and Perl as the server side solution.

So, what the heck, Java applications do require the user to have the JRE (and sometimes even the full JDK) on their local machine, don't they?!

Not to mention the size of the interpreter to download: on Windows for example (as we're talking about casual users) the JVM 5.0 is 15.5 MB and the JDK over 127 MB, while we have (free) dummy-proof Perl installers like ActiveState's Active Perl 5.8.7.813 which is just 12.7 MB (also bundled with many modules, docs and extra tools).

Not to mention that sometimes the Java user has to keep several different versions of the JVM, because of its lack of backwards compatibility, with the resulting CLASSPATH madness and headaches.

Not to mention that Perl offers tools like PAR, TinyPerl or PerlBin (just to limit the list to the free ones) that turn your Perl programs into single executables, by embedding perl itself and all the required modules into a single file, thus disproving the mentioned claim about the necessity to have the Perl interpreter installed on the user machine. A bright, real example of a successful advanced Perl client application, that you can download, install in a snap on Windows and use instantly without having Perl pre-installed is POPFile (it even contains an embedded HTTP server, to offer an HTML-based UI).

Not to mention that a couple of running Java applications can easily kill the user machine.

Not to mention that Perl is far more portable across different hardware and OSes than Java.

Not to mention a bunch of other things...

So, who could ever make a statement like the above mentioned one? Some Java taliban? Scott McNealy or Jonathan Schwartz?
No my friends, that statement, sadly, appears here, on a document entitled Popular Perl Complaints and Myths, supposedly published as mod_perl (and Perl in general) advocacy material, written by some of the most reputable Perl programmers around.

I certainly don't want to fight every opinion adverse to Perl, and I for myself as a programmer, often use languages other than Perl (yes, even Java). But I couldn't omit to counter a foolishness like that.

Emanuele.