Tag Archives: perl

Perl List Slice Weirdness

A colleague at work just found this little gem in File::Copy::Recursive: my $two = join ‘-‘, ( stat $cur )[0,1] || ”; That should pick out the device and inode, join them with a hyphen and set $two to the empty string if the stat failed. However, there’s a precedence problem: # Intended code. my […]

Java Leads To Great Libraries

Tim Bray wrote Having Done Java about how writing Java leads to better quality libraries. Needless to say, I disagree. I originally sent this by mail to Tim Bray, but I don’t think that there’s any reason to not publish it here as well. I’m afraid that I’m going to have to disagree with you […]

london.pm tech meet

I went to the London.pm tech meet last night. There was an excellent selection of talks, but the one that really caught my eye was Tom Hukins talk on Aspect.pm. Now, I’ve looked at AOP before, mostly in the context of Java and AspectJ. But every time I read about AOP, I came away with […]

Solaris Runtime Linker Fun

Most of the last week at work has been spent trying to coerce my way around the Solaris runtime linker (ld.so.1). The original task is to install a bunch of stuff like OpenSSL, PostgreSQL and Perl into a directory structure ($prefix) on the box. But where the task involves shared libraries, things get tricky… Compiling […]

Perl & Ajax

Well, my article on Using Ajax from Perl has finally been published. It’s about using CGI::Ajax and how it makes it really, really simple to add some of that Ajax magic to your own scripts. I’d love to have a look at HTML::Prototype next, as I’ve been looking quite jealously at all the lovely Prototype […]

Perl Improvements

I’m very pleased to see that Nicholas Clark has been given a grant for improving things in Perl. The stuff is useful and should bring big benefits to all Perl users. The one thing that really catches my eye is “making Perl relocatable”. This is a large annoyance for us at work, where we have […]

PUTting an URL

Today, somebody at work wanted to PUT some data to an URL. It’s part of an internal web service we use. Should be easy write. In Perl, it’s pretty trivial. my $ua = LWP::UserAgent->new(); my $req = PUT ‘http://example.com/dest’, Content => $ARGV[0]; my $resp = $ua->request( $req ); die $resp->status_line, “\n” unless $resp->is_success; That takes […]

XML::Genx 0.20

I pushed out a new release of XML::Genx last night. Nothing worth upgrading for, it just fixes a few compiler warnings under gcc 4.0. Thankfully, after some sage advice from Daniel Jalkut, I managed to get rid of the warnings I was complaining about. Unfortunately, there’s still one warning coming out. But it’s in code […]

XML::Genx Compiler Warnings

Naturally, one of the first things I did when I got the new mac was to try compiling my software, XML::Genx, on it. Sadly, it throws up a number of errors. Genx.xs: In function ‘string_sender_write’: Genx.xs:209: warning: pointer targets in passing argument 3 of ‘Perl_sv_catpv’ differ in signedness Genx.xs: In function ‘string_sender_write_bounded’: Genx.xs:223: warning: pointer […]

Last 100 lines in a file

Yesterday, I had to pick out the last 100 lines in a file, for a small log viewer I was writing. Neither the Perl FAQ nor the Perl Cookbook had quite the right answer. So, this is what I ended up with. sub last_lines { my ( $fh, $howmany ) = @_; my ( @lines, […]