[Dbix-class] inflators / defaltors

Jess Robinson castaway at desert-island.me.uk
Wed Mar 28 13:57:46 GMT 2007



On Tue, 27 Mar 2007, Bernhard Graf wrote:

> On Monday 26 March 2007 22:56, Goetz Bock wrote:
>
>> I would like to write an DBIx::Class tool for the sqlite3 database
>> generated by ulogd-sqlite3.
>>
>> The basic setup is very simple, but there are some stumbling blocks:
>> - IPs are stored as integer (should have been unsigned int, but my
>>   sqlite returns signed (negative) integers ).
>> - time is stored as an integer, too.
>>
>> I thought I could handle the IPs with an in-/de-flator:
>>
>> __PACKAGE__->inflate_column( 'ip_daddr' => {
>>     inflate => sub { inet_ntoa( pack( 'N', shift ) ) },
>>     deflate => sub { unpack( 'N', inet_aton( shift ) ) },
>> });
>
> Inflators work with objects only.

With references only (that arent scalar refs). There is a component in the 
works to allow if for everything. iirc it's ::Filter..

>> I've not even tried with the timestamp (oob_time_sec) and would
>> ultimately like to do queries like:
>>
>>     ->search( { ip_daddr => "80.254.137.0/24" } );

Deflators aren't currently used when you do a search, so that won't work 
regardless.. It'd be nice though, want to patch it?

Jess




More information about the Dbix-class mailing list