initial import of DBIx-Class-InflateColumn-IP 0.02000 from CPAN
[dbsrgits/DBIx-Class-InflateColumn-IP.git] / README
1 NAME
2     DBIx::Class::InflateColumn::IP - Auto-create NetAddr::IP objects from
3     columns.
4
5 SYNOPSIS
6     Load this component and declare columns as IP addresses with the
7     appropriate format.
8
9         package Host;
10         __PACKAGE__->load_components(qw/InflateColumn::IP Core/);
11         __PACKAGE__->add_columns(
12             ip_address => {
13                 data_type => 'integer',
14                 is_nullable => 0,
15                 is_ip => 1,
16                 ip_format => 'numeric',
17             }
18         );
19
20         package Network;
21         __PACKAGE__->load_components(qw/InflateColumn::IP Core/);
22         __PACKAGE__->add_columns(
23             address => {
24                 data_type => 'varchar',
25                 size        => 18
26                 is_nullable => 0,
27                 is_ip => 1,
28                 ip_format => 'cidr',
29             }
30         );
31
32     Then you can treat the specified column as a NetAddr::IP object.
33
34         print 'IP address: ', $host->ip_address->addr;
35         print 'Address type: ', $host->ip_address->iptype;
36
37 METHODS
38   ip_class
39     Arguments: $class
40
41     Gets/sets the address class that the columns should be inflated into.
42     The default class is NetAddr::IP.
43
44   ip_format
45     Arguments: $format
46
47     Gets/sets the name of the method used to deflate the address for the
48     database. This must return a value suitable for "$ip_class-"new(); The
49     default format is "addr", which returns the address in dotted-quad
50     notation. See "Methods" in NetAddr::IP for suitable values.
51
52   register_column
53     Chains with "register_column" in DBIx::Class::Row, and sets up IP
54     address columns appropriately. This would not normally be called
55     directly by end users.
56
57 AUTHOR
58     Dagfinn Ilmari MannsÃ¥ker, "<ilmari at ilmari.org>"
59
60 BUGS
61     Please report any bugs or feature requests to
62     "bug-dbix-class-inflatecolumn-ip at rt.cpan.org", or through the web
63     interface at
64     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-InflateColumn
65     -IP>. I will be notified, and then you'll automatically be notified of
66     progress on your bug as I make changes.
67
68 SUPPORT
69     You can find documentation for this module with the perldoc command.
70
71         perldoc DBIx::Class::InflateColumn::IP
72
73     You can also look for information at:
74
75     * AnnoCPAN: Annotated CPAN documentation
76         <http://annocpan.org/dist/DBIx-Class-InflateColumn-IP>
77
78     * CPAN Ratings
79         <http://cpanratings.perl.org/d/DBIx-Class-InflateColumn-IP>
80
81     * RT: CPAN's request tracker
82         <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-InflateColumn-I
83         P>
84
85     * Search CPAN
86         <http://search.cpan.org/dist/DBIx-Class-InflateColumn-IP>
87
88 SEE ALSO
89     DBIx::Class, NetAddr::IP
90
91 COPYRIGHT & LICENSE
92     Copyright 2007 Dagfinn Ilmari MannsÃ¥ker, all rights reserved.
93
94     This program is free software; you can redistribute it and/or modify it
95     under the same terms as Perl itself.
96