2 DBIx::Class::InflateColumn::IP - Auto-create NetAddr::IP objects from
6 Load this component and declare columns as IP addresses with the
10 __PACKAGE__->load_components(qw/InflateColumn::IP Core/);
11 __PACKAGE__->add_columns(
13 data_type => 'integer',
16 ip_format => 'numeric',
21 __PACKAGE__->load_components(qw/InflateColumn::IP Core/);
22 __PACKAGE__->add_columns(
24 data_type => 'varchar',
32 Then you can treat the specified column as a NetAddr::IP object.
34 print 'IP address: ', $host->ip_address->addr;
35 print 'Address type: ', $host->ip_address->iptype;
37 DBIx::Class::InflateColumn::IP supports a limited amount of
38 auto-detection of the format based on the column type. If the type
39 begins with "int", it's assumed to be numeric, while "inet" and "cidr"
40 (as used by e.g. PostgreSQL) are assumed to be "cidr" format.
46 Gets/sets the address class that the columns should be inflated into.
47 The default class is NetAddr::IP.
52 Gets/sets the name of the method used to deflate the address for the
53 database. This must return a value suitable for "$ip_class-"new(); The
54 default format is "addr", which returns the address in dotted-quad
55 notation. See "Methods" in NetAddr::IP for suitable values.
58 Chains with "register_column" in DBIx::Class::Row, and sets up IP
59 address columns appropriately. This would not normally be called
60 directly by end users.
63 Dagfinn Ilmari Mannsåker, "<ilmari at ilmari.org>"
66 Please report any bugs or feature requests to
67 "bug-dbix-class-inflatecolumn-ip at rt.cpan.org", or through the web
69 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-InflateColumn
70 -IP>. I will be notified, and then you'll automatically be notified of
71 progress on your bug as I make changes.
74 You can find documentation for this module with the perldoc command.
76 perldoc DBIx::Class::InflateColumn::IP
78 You can also look for information at:
80 * AnnoCPAN: Annotated CPAN documentation
81 <http://annocpan.org/dist/DBIx-Class-InflateColumn-IP>
84 <http://cpanratings.perl.org/d/DBIx-Class-InflateColumn-IP>
86 * RT: CPAN's request tracker
87 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-InflateColumn-I
91 <http://search.cpan.org/dist/DBIx-Class-InflateColumn-IP>
94 DBIx::Class, NetAddr::IP
97 Copyright 2007 Dagfinn Ilmari Mannsåker, all rights reserved.
99 This program is free software; you can redistribute it and/or modify it
100 under the same terms as Perl itself.