Perl: Connecting to an Oracle database WITHOUT having an installed client

I started this post with the intention of having it be a quickie, just showing people how to connect to Oracle with Perl/DBI without having to have Oracle client or even Perl installed, but it’s not that simple.  So I decided to rewrite it with detailed instructions.

Here is a list of what I used:

Machine: Sun Solaris SPARC on build and target machines
Oracle: Oracle 10g client (build machine only)
Perl: v. 5.10.0 (build machine only)
Perl modules: DBI, DBD::Oracle (1.22), PAR (1.008), pp (1.025), PerlIO (1.04) (build machine only)

Continue Reading…

Perl Crash Course: Introduction to Perl

Perl – the Practical Extraction and Report Language (or Pathologically Eclectict Rubbish Lister) was created by Larry Wall in the late 1980’s. It started as a combination of Larry’s favorite Unix tools such as sed, awk, and shell, and grew to be the best language for text manipulation.

I started learning Perl back in 1998 by myself. What made it possible for me to do that was that Perl scripts, like shell scripts, are not compiled binaries. You can open it with a (good) text editor and see exactly what the programmer did to make it work. Same thing with HTML, JavaScript, CSS, and all other democratic languages around. No reverse-engineering needed.

Speaking of Web technologies, Perl was considered SO GOOD with manipulating texts, that it was once the #1 language for CGIs. For those of you who don’t know, CGI stands for Common Gateway Interface and it was the way websites could show dynamic data back in the early days of the Internet. In fact, Perl was so popular with CGIs, that many people didn’t (and still don’t) know it could do anything else. On the contrary, although Perl has excellent Web modules such as Catalyst, Template::Toolkit, HTML::Mason, and so many others, it’s not my first choice for Web development (for reasons that are not in the scope of this course). However, I can’t live without it for anything else.

Perl is portable: you can write one script and run it in just about any Operating System that has a Perl interpreter installed. And you can find Perl interpreters for practically all the OS’s around.

Perl is fast: although the Perl interpreter needs to read, parse, compile, and run the script on every execution, it’s still VERY fast by any standard.

Perl gets faster: there are ways to bypass the first 3 stages of the Perl execution, either by using mod_perl for Apache, or by using the Perl Archive Toolkit, which gives you a precompiled (albeit potentially large) binary of your script.

Perl is Object Oriented: ok, that didn’t sound right. Perl can be used from either a procedural or an object oriented scope. In real world applications, you’re likely to mix both cases to suit your needs.

Perl is extremely high level: this means that given the statements in your script, you are likely to be able to read them as you would plain English. This was done on purpose, of course, given the fact that Larry Wall is a linguist.

Perl is free: you can download it with no cost from several distributors, install, and use for any purpose – commercial or otherwise and not have to worry about licensing.

Perl is free form: you can write the code practically in any way you like and get away with it. This is great as long as you keep in mind that writing good code also means writing clean code. You can seriously hurt your foot if you’re not careful. Obfuscation is only fun when it’s intentional.

I can go on forever telling you all that Perl can do, especially if I decide to talk about CPAN, the Comprehensive Perl Archive Network – a website with over 10,000 100,000 modules over 25k distributions for everything you can think of, from complex math and graphic manipulation to fooling around with the Klingon language. You can even use the Perl/Tk to create graphical user interfaces.

If what I said so far was enough to interest you to learn Perl, then keep on reading. There’s something to the language that feels almost addictive, if you don’t let all the non-initiated folks make up your mind against it…

« TOC | Getting it installed on… »