Thursday, April 28, 2005

"I felt like Don Knotts attempting to digest Orson Welles."

from Lileks.

Tuesday, April 26, 2005

Compiling your own Perl - part 2: The Oracle Mod

Perl has a very useful generic database module called DBI. This mod does not, by itself, allow you to connect to any specific database. However, with the proper DBD module driver(DBD::) you can use the same code with different databases(providing the SQL you are using isn't in any way customized for that database). In the case of an open-source database (PostGreSQL, MySQL, SQLite, etc.) you can obtain everything you need to build the DBD module from the web. In the case of Oracle, you will have to have a purchase copy, an active Oracle database, and the client software loaded on your machine.

Mod's you will need:

DBI is required before any DBD mods can be added. If you followed yesterday's instructions, and didn't have any problems with it, you should have a functional perl and a solid compilation environment to make modules. Here are the instructions for compiling DBI.
  1. Download DBI from CPAN and uncompress it in the same directory that the perl source code is in (C:\Dev\src\DBI-1.48 is mine for example).
  2. chdir into that directory.
  3. type: perl Makefile.PL
  4. type: dmake
  5. type: dmake test
  6. type: dmake install
  7. The above pattern is fairly standard for most perl mods. It's always a good idea to read the README and INSTALL files to make sure that some other step isn't required, but it is pretty unusual for anything else to be required. From this point on the above pattern will be referred to as the MAKE SEQUENCE.
  8. Assuming no error outputs, you should now have a functional DBI mod.
The next stage is to compile the DBD::Oracle mod. It requires a few things.
  1. An active oracle database.
  2. You must have a login to that db.
  3. You must install the Oracle client software, specifically you must install the C/C++ tools. In general you'll want to install anything that says 'C development' or header files. If I seem a little vague here, it's because I don't currently have to CD to see what components I installed.
  4. If all of these exists you can start the MAKE SEQUENCE. Perl Makefile.PL will give some warnings and make some noise, and dmake should execute cleanly. Then, you are ready to test.
  5. You need to type SET ORACLE_USERID=username/password@dbname on the command line. This will allow the tests to run. All tests should pass(some may be skipped). **WARNING** the extra tests run in will fail, due to the fact that it expects ORACLE_USERID to just equal username/password. So type SET ORACLE_USERID=username/password and then type the command perl dbname. You should look for the 'expected' results.
  6. Assuming you've gotten this far with clean compiles and tests, it's time to dmake install
  7. Finished.
Next installment: LWP and Crypt::SSLeay.

Monday, April 25, 2005

Making your own Perl - Part1

I'm a Perl programmer. I've been working with the language for about five years now. The language is general purpose, but it has it's origins in sed, awk, and UNIX shell text processing. That is the purpose I use it for most of the time.

Anyway, My company was using(still is actually) an older version of Perl due to the fact that Activestate doesn't support the DBD::Oracle driver. I spent about four or five hours compiling a new Perl executable and Driver. I also added in a few other things. It was, for the most part, not too difficult, but I thought I'd share how I did it so that other's who are looking for solutions to the problems I encountered can solve them. Today I will cover the Perl executable.

To compile Perl, you need to do the following:
  1. Download a stable Perl from CPAN.
  2. Download the MinGW compiler from Here(You only need the MinGW install file. This is listed under Current/MinGW(and is currently MinGW-3.1.0-1.exe).
  3. Download dmake from CPAN. It's a special version of make(that is somewhat old) that seems to be the only one that works to compile Perl with MinGW.
  4. Uncompress/Install them(windows users will need a tool to decompress tar.gz files. WinZip handles it. IZarc, unfortunately, does not. I used the 7za.exe command line tool from 7-Zip).
  5. place the uncompressed Perl directory somewhere on the C drive so that the full path to that directory has NO spaces in it(so don't try to compile under "My Documents" for example). For my part, I created a folder called "Dev" directly on the C drive, then I dropped the stable Perl source in a folder called "src". So the Perl source was in "C:\Dev\src\perl-5.8.6".
  6. When MinGW installs, it should locate itself on the C Drive. From the dmake archive, lift the dmake.exe executable and the sub-folder "startup" and place them in "C:\MinGW\Bin".
  7. Add "C:\MinGW\Bin" to your PATH directory.
  8. Chdir to C:\Dev\src\perl-5.8.6.
  9. chdir to "win32".
  10. in the win32 directory, type dmake -f "". (That "-f" is really important. Without it, dmake will automatically try to use the "Makefile" file instead of "". The "Makefile" file is written for the Microsoft "nmake" utility and the VC++ compiler.)
  11. If you are running Windows NT, 2000, or XP, then you should be seeing some successful compilation going on, this will take a while. (If the compile stops with an error, usually followed by the words "dmake exited with a status of 1" or something like that. Then you'll have to start doing your research. I haven't had any problems with compilation at this stage. So if you do, it's time to google.)
  12. When the compilation finishes, assuming it didn't terminate with errors, it will be time to test. Type: dmake -f test.
  13. This will, again, take some time. Some of the tests will be skipped, but for me all tests not skipped passed. Once again, failure will require research on your part.
  14. Once you've reached all tests passed, it's time to install. Type: dmake -f install on the command line. install's are just files being copied, or documentation being made. Don't be surprised to see a lot of errors when the HTML files generate, usually the errors are not fatal, and the documentation will be created.
  15. Now it's time to code some Perl. That's pretty much it. The perl executable will be located at C:\Perl\Bin(You can change this in the Makefile if you want, but you can't put Perl in a path without spaces so this one does just as well as any). Now it's time to learn how to use it.
That's all there is to it. If you have problems it sometimes helps to read README.Win32 in the main directory. Tomorrow I will start with the Oracle module, if I have time.

Tuesday, April 19, 2005

More Humor

The author here is trying to make a point, but I'm just chortling over the phrase "Pope Bill Clinton the 1st."

Monday, April 18, 2005

Funny quotes... brother told me about this weekend. He said that he read them off of some discussion thread.
  • What is the purpose of Marriage? To provide an institution who's participants can engage in God approved sex.
  • On the subject of Peta and it's viewpoints: If God didn't intend for us to eat animals, then why did he make them out of food?