Wednesday, April 29, 2009

Building vim on os x 10.5

I like to build my own version of vim on systems. This usually avoids any problems later when I want to add something new in to it or upgrade to a newer version.

In the past older versions of OS X (10.4 and 10.3 ) I could just build vim straight but on 10.5 I had a strange issue of it starting up X11 when I ran it in my terminal window.

It seems that either vim or OS X became smarter when it came to talking between process using X Windows communication protocol. (XSMP)

Just adding a --without-x to the configure statement didn't help. It required disabling the XSMP protocol.

Here is the configure line:
./configure --without-x --disable-xsmp
Much better, now I just need to figure out the best terminal font for my 24" iMac. :)

Tuesday, April 7, 2009

3 ways to disable auto typing in SOAP::Lite client

Often SOAP::Lite will try to autotype a parameter in a request and it does it wrongly (or correctly) causing the SOAP server to fail badly (for so many reasons).

SOAP::Lite provides three ways to disable this typing. Two of the ways work at the client object level and the other does it at the SOAP::Data object level.

Client Level

The following options disable autotyping for all data items in a request:
  • autotype method. After creating a SOAP::Lite client you can disable autotyping by $soapclient->autotype(0).
    my $soap = SOAP::Lite->uri($xmlns)->proxy($proxy)
    ->on_action( sub {"$action?type=$reqname&ns=$xmlns"} );
  • Overriding the typelookup method. You can override the typelookup to run undef/false/etc.
    sub typelookup { return undef; }

Data object

SOAP::Data object provide a type method. This allows manually typing of the object. When this is set to an empty string no type is set nor is it autotyped by serializer. Note: undef doesn't work you must use empty string.

Here is an example:
my $range = SOAP::Data->name(
'DateRange' => \SOAP::Data->value(
SOAP::Data->name( 'StartDate' => $start )->type(''),
SOAP::Data->name( 'EndDate' => $end )->type('')
Someone else suggested creating SOAP::Data object directly from XML in this cause type is set to whatever value is included in the XML document.

Thanks the SOAP::Lite mailing list for the some of the ideas.