I’m certainly delving into some depths of Perl I’ve never touched before.
I need to lookup a record in one table using a subclass of DBIx::SearchBuilder::Record, and depending on what it says in the “table_name” column, look up a record in one of several other tables, each one of which has its own subclass of DBIx::SearchBuilder::Record. And after some delving on the internet, I was amazed to find out you could put the class name in a variable when you “new” it. Unfortunately you still need to “eval” the require statement.
my $mainRec =
# Ok, here comes the tricky part. Try to get figure out the class name
# from the table name
my $table_name = $mainRec->table_name;
$table_name =~ s/^dsu/DSU/i;
$table_name = ucfirst($table_name);
$table_name =~ s/_([a-z])/uc($1)/eg;
$table_name =~ s/s$//;
no strict 'refs';
my $fullClass = "RTx::FooProject::Record::$table_name";
eval "require $fullClass";
$subRec = $fullClass->new($cfHandle);
I literally threw my hands in the air in exultation when it worked. And then was rather painfully reminded of my recent shoulder surgery.
I was having trouble sleeping. I thought it was because I have a sort of “rubbed raw” feeling in my arm pit. I got the same thing last time – because I can’t lift the arm, my arm pit doesn’t dry out properly and so it rubs painfully. But then I realized there was a lot of light coming from my office. And so I went to have a look, and sure enough my Linux box had crashed, frozen on boot, and so therefore the screen saver wasn’t shutting down the monitors properly.
A few days ago I got a little overzealous in removing old kernels, and since then every time the update process has installed new stuff it’s given me a failure message about running lilo. (Yes, I still use lilo rather than grub because when I first installed this system you couldn’t use grub with a software raid and lvm2 – one of these days I’m going to have to reinstall just to correct that and a few other nagging problems)
I realized that if that was the cause of the problem, I was going to have to boot with a live or rescue CD and remount everything, chroot to it, and fix the lilo problems and run the lilo installer command. So the first thing I tried was downloading the “Ubuntu Rescue Remix”, burning a CD with it, and booting with it. I discovered the hard way that the “Rescue Remix” is a i686 kernel, which means I can’t chroot to my amd64 install and expect to run commands. Oops.
Next I started to download the latest Ubuntu CD. Chrome said I had 27 minutes remaining, so while I waited I dug out the previous Ubuntu CD, and booted with that. I had to “apt-get install lvm2” and “apt-get install mdadm”, but afterwards I was able to “mdadm –assemble” both software RAIDs, and mount the lvm2 partitions under /mnt. I chrooted to /mnt, and ran “lilo”. First problem was that the boot drive was specified using /dev/disk/by-id/…., which it didn’t like in the chroot environment, so I changed that to /dev/sda. Then it complained about the “Linux.old”, so I commented that out. With both of those changes made, lilo installed without any further errors, and when I rebooted everything came up fine.
I’m just manually restarting all my nightly backups which normally happen during the time the computer was down, and then I’m going to try to get an hour or two sleep.
Had a dream last night, in which the programming language Forth played a big role. Which is a bit of a puzzlement because I’ve never learned to program in Forth. There was a time when Forth was tagged as the next big thing and every computer magazine had articles about it, but that was around the time when commercial software started advertising “written in C for speed” and an interpreted language like Forth didn’t have a chance. I believe Forth became the core of PostScript.
The first thing I remember from the dream is seeing two small computers with a wire connecting their ‘pin 1’s. Somebody asked the Forth guru why they were connected, and I said “I know that, it’s so their clocks are in sync” and I said something about events on rising edges. I have no idea what that’s about – I’ve never done anything that low level. Evidently my dream self has been taking electrical engineering courses.
Later I was talking to the guru in front of three real train tracks, and every time a train went by a single alphanumeric letter above the track lit up. I wonder if that is some dream reference to the famous Tech Model Railway Club, but I really only know about them from the Jargon File. I wonder if they used Forth?
Later the guru was showing me about ports to respond to external events and control things like lights and heat in a house. I distinctly remember a panel showing four room mates and an indicator of whether they were using Forth to control their thermostats or not.
Anyway, it seems odd to me to be dreaming about a programming language I’ve never used, and low level hardware stuff I’ve never done. Not sure if that’s a subconscious reflection of my recent surgery, or trying to do object oriented programming in Perl.