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 ]

jhorwitz (4227)

jhorwitz
  reversethis-{gro.gnihsams} {ta} {ffej}
http://www.smashing.org/

System administrator, Perl hacker, author of "Unix System Management Primer Plus" (SAMS 2003), mod_parrot, extproc_perl, Authen::Krb4, Authen::Krb5.

Journal of jhorwitz (4227)

Monday October 04, 2004
07:20 PM

DBD::SQLite alignment fix

I have a patch that fixes DBD::SQLite on Sparc so it passes all its tests and doesn't core dump. Turns out GCC likes to inline its own "optimized" version of memcpy, which assumes 8-byte aligned structures. SQLite does a buttload of casting from char * to structures and back, which wreaks havoc on this assumption.

The solution was to coerce GCC into not using its own inline memcpy without affecting other inlining. Turns out all you have to do is make the size argument a variable rather than a constant. So I changed lines like this:

memcpy(to, from, 8);

to this:

int sz = 8;
memcpy(to, from, sz);

I'll send this off to Matt tonight, and I should also port it to the main SQLite codebase. This took way too long to figure out...

Tuesday September 21, 2004
03:38 PM

The joys of digital coffee

http://www.smashing.org/images/flavia_error.jpg

At least the free carafes of coffee were still available.

Monday September 20, 2004
02:31 PM

source code

Get your mod_parrot here.
Friday September 17, 2004
06:49 PM

request_rec goodness

Three weeks of work on mod_parrot have culminated in this piece of code:

.namespace [ 'MyHandler' ]

.sub _handler
        .local pmc r

        find_type $I0, 'Apache::RequestRec'
        r = new $I0
        r.'puts'("Just a bunch of text.")
.end

I was able to encapsulate Apache's request_rec structure in a Parrot object, and I've implemented a 'puts' method that calls ap_rputs using the request_rec and the supplied string.

You can use this as a content handler in httpd.conf:

<Location /parrot/mydir>
    SetHandler parrot-code
    ParrotHandler MyHandler /path/to/bytecode
</Location>

Now, you can write entire handlers in Parrot, but the real goal is to have higher-level languages use Parrot to instantiate Apache::RequestRec objects and use them as they see fit for mod_perl, mod_python, or mod_whatever. mod_parrot will act as the layer between the language and Apache -- infrastructure we can write once instead of once for each language. A lofty goal, yes, but so is everything with Parrot.

Source code is coming soon.

Thursday September 09, 2004
10:14 AM

Squawks of Apache

I'm happy to report that mod_parrot lives! After two weeks of scattered work, Apache is able to call individual subroutines as location handlers, and parrot can access Apache's request_rec structure and use it to call into the Apache API. That last bit was really the final proof-of-concept, so now I can start thinking about what direction I want to take this.
Tuesday August 31, 2004
02:52 PM

mod_parrot update

Much progress in the mod_parrot world. I spent the last week re-learning Parrot, since I really haven't touched it in a year, but I eventually got to coding a few days ago. My overall goal, btw, is to provide code that will serve as the basis for the parrot version of mod_perl (and other languages). And based on what I've seen this week, it can be done.

The original mod_parrot was limited by the Parrot API at the time, and only ran bytecode as a whole program, a la Apache::Registry. Nowadays we have goodies like namespaces and the ability to call Parrot subs from C (handlers!), making things much more interesting. This week I'm focusing on writing some internal wrappers for calling Parrot subs and the Apache module hooks. From there things are hazy, since there are so many directions I can go once I have an Apache module. I'll probably need to create a roadmap of sorts to keep my brain organized.

Monday August 30, 2004
01:53 PM

Monocle beta

I've spent the past month or so writing a new monitoring system. Yes, yet another monitor. Why, you ask? Well, as a career sysadmin I grew tired of all the complex, difficult to configure open source monitoring products out there. Nagios comes closest to what I need, but its configuration and web interface give me headaches, and there are few detailed reporting options.

So I wrote Monocle. Monocle is written in Perl. It has no configuration files. No GUI. no web UI. Just a server, some commands to configure it, and an embedded database. It has reporting features that let you answer questions like, "Was our service down last night at 3:45 AM?", and "Was our response time faster the first week of June than the first week of July?", and of course, "What was our uptime for the month of January?" Anyone with an SLA on their services will appreciate these reporting features.

This is nothing revolutionary. Just a simpler design with the core features I think belong in a monitoring system.

If anyone wants to try it out, I put up a simple web page here. It's still in beta, so bug reports are most appreciated!

Thursday August 26, 2004
10:50 AM

mod_parrot

Since Dan now wants to flex Parrot's embedding interface, I've just volunteered to take over the mod_parrot project for the time being. Since it meshes well with my goal of extproc_parrot (Oracle stored procedures in Parrot-based languages), I thought it made sense to volunteer.

Now I need to dig around some code and see what I've gotten myself into..

Sunday August 01, 2004
12:21 PM

Home again

OSCON was fun, but way too short -- time just flew by. As for talks, I really enjoyed Theo's talk on Wackamole, which for me, as a career system administrator, is quite interesting. But of course, the real reason for OSCON is the socializing. I hung out with my usual Perl crowd (plus Chris ;-) most of the time, but hung out with some of the PHP guys Thursday night, most of whom I've only met in passing. It was a good time. The SAMS author dinner was also fun, as usual.

I came home a few hours before a massive line of thunderstorms rolled through, taking down half a tree in my backyard and washing away half the mulch in my garden. A homeowner's work is never done...

Wednesday July 28, 2004
12:14 PM

Finally in Portland

Tuesday was quite a day of traveling for me. Thunderstorms were running rampant in Philly, so after delaying boarding for half an hour, we spent 2 hours sitting in the plane at the gate and on the tarmac just waiting for storms to pass. I missed my connection in Chicago before we even took off. What's worse, I missed the 7:40 to Portland that was boarding just after I arrived in Chicago.

So they put me on standby for the 9:30, with a double booking on a Wednesday morning flight *just in case*. Thankfully, I got the last seat on the flight and got into Portland around 11:30. Took a shuttle to the hotel, where Geoff bought me a beer, which was sorely needed.

Anyway, I'm here. See y'all around Portland!