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 ]

ivorw (5222)

ivorw
  (email not shown publicly)
http://myweb.tiscali.co.uk/ivorw

Journal of ivorw (5222)

Monday August 22, 2005
12:02 PM

Overriding Perl 5 built in functions

I've been working on Devel::Leak::Object, including the stringification patch which is very useful :) (RT rocks, as does mca).

I had a problem in that I wanted to defer tracking of the bless function until initialisation is complete. I've since discovered that this is not possible - see my post to Perlmonks.

I have gained an understanding of what happens with overrides of built in functions. The crucial point is that these overrides happen at compile time. This means that if you have already used (or required) a module before putting the override in place, it is too late for the override to take effect.

This means that the override also has to be physically first in the script file before the use statements that you want to override, thus:

#!/usr/bin/perl

use strict;
use warnings;

use Foo; # override not in place
use Devel::Leak::Object qw(GLOBAL_bless);
use Bar; # with bless overriden

I also looked at what use subs qw(foo); achieves. What this does is merely a dummy export into its caller's namespace. Once done, a typeglob named foo will exist in the stash, hence will be picked up when parsing barewords. This also affects calls to built ins, which will use the local sub instead. Instead of "use subs", what I needed to do was to export my &bless into other namespaces, as that is what I want to get called.

There is actually no need to do this in my case, as CORE::GLOBAL magic achieves the same results - unless I want to be picky about exactly in which classes I want bless to be overriden.

I might well release this functionality (to allow people to be picky) into Devel::Leak::Object 0.03.

Tuesday July 12, 2005
04:37 AM

Business as usual

Today I return to my client's office - the London Clearing House, for the first time since the London bombings. The office is next door to Aldgate Underground Station - where one of the bombs went off. Apparently the building shook when it went off.

Thursday morning, I was travelling into work normally, scheduled to get in at around 09:30. I arrived at Whitechapel, 300 yds northeast of the office via a circuitous route, to find my colleagues assembled - this was our muster point. The office had been evacuated, and was inside a police cordon.

At 10:30, we were advised what to do. Key individuals, whose presence is needed were advised to make their way to the business continuity suite on the South Bank. Others were advised to go home. Those who were technical with the capability of dialling in were asked to work from home. I arrived home at around 14:00 as there was little or no transport crossing east to west.

Today, I come in to the office to read several emails stating that LCH's member banks and the regulatory authorities were impressed by our disaster recovery operation. We were up and running from the business continuity suite within an hour, and the members didn't bat an eyelid. It was also a busy time with the markets, with runs on equities and bonds triggered by the bombings.

I second this, as the attitude of colleagues mustered at the assembly point, and those at the BCS, was one of calm. We have had many business continuity drills and disaster recovery failover exercises in the 2 1/2 years I have been working at LCH. In the event, nobody was panicking, everybody was professional and we all knew what to do. It was, in effect, business as usual.

Friday July 01, 2005
06:34 AM

Toronto pictures

Sunday June 26, 2005
04:43 PM

Toronto - first impressions

Flew in yesterday from LHR (London Heathrow). The first thing to notice is the temperature: >30°C. Granted we have had hot weather in London recently, but it was not as hot, and unpredictably mixed up in a traditionally British way, with intermittent overcasting clouds and thunder storms.

The second thing to notice is that many buildings in Toronto are only half built. This includes the airport. International passengers were bussed from "Terminal Infield" (or perhaps this should be terminal outfield or perhaps terminal in field :), to the main terminal building where immigration and customs etc. are. Having done the necessary stuff here including retrieving my luggage, I find that there is no bar in the building. So I take a taxi to 89 Chestnut - the conference venue which is also where I'm staying.

There's no bar in this building either - it is a student residence, but the security man recommends Mr. Greenjeans which is inside a mall called the Eaton Centre. The idea of a pub inside a shopping mall does not appeal, as this combination in England is a recipe for disaster, but this bar seems OK.

Today I've been exploring and getting other matters sorted out like the right kind of adapter plug to use with my laptop, and internet access from my room (I'm using this to post this journal).

The feeling of Toronto is quite cosmopolitan - most of the shops here seem to be run by Asians: Chinese or Indians. It was an Indian shop that was able to help with getting me the right mains plug adaptor.

Looking forward to the conference. Will see how it pans out. May post more perlish journals if I get the urge.

Sunday June 12, 2005
02:11 PM

fixin them shebangs

I have a machine with several different versions of perl on it. In particular, the default one I am wanting it to use for the present is /home/knoppix/ivor/stable/bin/perl

This was a relatively freshly built perl, and I found that none of the scripts worked, as they were looking for a perl in /usr/local/bin/perl - I deliberately did not put one there; the O/S supplied one was in /usr/bin/perl.

This prompted me to look into how scripts get installed. I found that ExtUtils::MM_Unix.pm has a method call fixin which becomes available through inheritance as ExtUtils::MY->fixin. Just pass in some paths of perl scripts as parameters, and they get shebangled - that's if they have a shebang line.

You can do this from the command line, in a similar fashion to how make does with exe_files:

perl -MExtUtils::MY -e 'MY->fixin(@ARGV)' *.pl

I've also tracked through to the Config, where it gets the information about what to put into the shebang line. This is in $Config{startperl}. If you want the scripts to be shebanged to somewhere exotic when you install them, hack Config.pm or edit config.sh (and remake your perl) to set startperl to be the correct place. You might also need to tweak perlpath in a similar way.