DBD::Oracle + Cygwin: Undefined reference error during make

Yesterday I found myself in a position of having to re-master my computer – hence having to reinstall most of the applications including my trusty Cygwin – which always becomes somewhat of a headache when I reach the point of installing DBD::Oracle in it.

This time I got a undefined symbol error. A quick look in Google showed me that Erik Squires had the same exact problem. Lots of searching later, I find that Google can’t find a handy solution anywhere… So I send Erik an email asking about the solution and to my surprise, he answers only 1 (!!) minute after I click send. Talk about a fast reply!!

Hats off to Erik! You will find the solution here: http://cpae.typepad.com/capacity_planning_and_eng/

Hint: the oci.def that he mentions in his post is inside your DBD::Oracle build directory. Don’t get it confused with ocidef.h file in your $ORACLE_HOME/oci/include directory (that’s where I looked first).

I’m adding the error message below with a big SOLUTION header for any Googler out there having the same problem. No need to keep reading if the text above was enough to solve your problem.

Continue Reading…

What’s use strict; in Perl?

Many unseasoned Perl programmers or people who never really dove into the Practical Extraction and Report Language think it’s an ugly language, or at least a dangerous one. And it actually can be… but not all is lost!

use strict; is a Perl pragma which essentially keeps you from shooting yourself on the foot. It tells Perl to make you declare your variables, use lexicals, and basically make your write your programs in a way that they won’t eventually get you fired.

print $var;

Hello World

Note that in the snippet above we added my just before the variable. This tells Perl that $var will be valid in the outer-most block of code. Since there are no (explicit) blocks, it makes $var act like a global variable.  Now, suppose you need to reuse the variable name inside another block of code, this what you would get:

#!/usr/bin/perl -w

use strict;

my $var = "Hello World\n";

print $var;

    my $var = "A new value\n";
    print $var;

print $var;

Hello World

A new value

Hello World

There are some scenarios where you might have trouble with use strict; and might want to cheat a bit… in that case, you can do it with no strict; or its variance containing what you don’t want to be strict on: no strict ‘vars’; or no strict ‘subs’;

If you’re interested, you can find more pragmas here.