[Dbix-class] new module: DBIx::Class::InflateColumn::IP
Dagfinn Ilmari Mannsåker
ilmari at ilmari.org
Thu May 24 03:19:42 GMT 2007
Hi all,
I've just hacked up my first ever Perl module headed for CPAN:
DBIx::Class::InflateColumn:IP, which inflates IP address columns to
NetAddr::IP objects. Currently it only supports addresses stored as
integers in the database; netmask support and more flexible storage
format options are on the TODO list.
Without further ado, Here's the SYNOPSIS section of the POD:
Load this component and declare integer columns as IP addresses.
package Host;
__PACKAGE__->load_components(qw/InflateColumn::IP Core/);
__PACKAGE__->add_columns(
ip_address => {
data_type => ’integer’,
is_nullable => 0,
is_ip => 1,
}
);
Then you can treat the specified column as a NetAddr::IP object.
print ’IP address: ’, $host->ip_address->ip;
print ’Address type: ’, $host->ip_address->iptype;
While I wait for my PAUSE id application to come through I would be
delighed if anyone would care to take a look at the code and comment on
any mistakes I might have made. It can be checked out from SVN (thanks
Matt!) at
<http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class-InflateColumn-IP>
or downloaded from
<http://ilmari.org/perl/DBIx-Class-InflateColumn-IP-0.01.tar.gz>
--
ilmari - CPAN debutant
More information about the Dbix-class
mailing list