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 ]

Matts (1087)

Matts
  (email not shown publicly)

I work for MessageLabs [messagelabs.com] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Tuesday April 01, 2003
10:18 AM

pack two heads

[ #11373 ]

Every now and then perl reveals a nice sweet feature that I didn't know existed before.

I need to send multiple strings across http. If I were doing this via RFCs I'd probably separate the strings with MIME boundaries. But I need speed and the most compact representation possible, so I'm using network-strings - length followed by the string itself. This way I can support binary strings (the first string contains \0's).

I figured I was going to have to do pack("Na*", length($string), $string), but no! Perl's pack() function lets me do:

pack("N/a*", $string)

And it all Just Works. The template above gives me a network-string. Sweet.

In other news, I hacked my open firmware today to support non-mirrored external displays ("extended desktop"). This is very cool. I've had a 19" LCD monitor sitting on my desk barely used since I started coding on my ibook. So now I have it hooked up to the iBook, and I have the screen arranged above the main laptop screen. It's very very cool IMHO.

All this is probably old hat to most people. But I'm still getting a kick from dragging windows from one screen to another. :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.