.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBIx::Class::InflateColumn::IP 3pm" .TH DBIx::Class::InflateColumn::IP 3pm 2024-02-21 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME DBIx::Class::InflateColumn::IP \- Auto\-create NetAddr::IP objects from columns. .SH SYNOPSIS .IX Header "SYNOPSIS" Load this component and declare columns as IP addresses with the appropriate format. .PP .Vb 10 \& package Host; \& _\|_PACKAGE_\|_\->load_components(qw/InflateColumn::IP Core/); \& _\|_PACKAGE_\|_\->add_columns( \& ip_address => { \& data_type => \*(Aqbigint\*(Aq, \& is_nullable => 0, \& is_ip => 1, \& ip_format => \*(Aqnumeric\*(Aq, \& } \& ); \& \& package Network; \& _\|_PACKAGE_\|_\->load_components(qw/InflateColumn::IP Core/); \& _\|_PACKAGE_\|_\->add_columns( \& address => { \& data_type => \*(Aqvarchar\*(Aq, \& size => 18 \& is_nullable => 0, \& is_ip => 1, \& ip_format => \*(Aqcidr\*(Aq, \& } \& ); .Ve .PP Then you can treat the specified column as a NetAddr::IP object. .PP .Vb 2 \& print \*(AqIP address: \*(Aq, $host\->ip_address\->addr; \& print \*(AqAddress type: \*(Aq, $host\->ip_address\->iptype; .Ve .PP DBIx::Class::InflateColumn::IP supports a limited amount of auto-detection of the format based on the column type. If the type begins with \f(CW\*(C`int\*(C'\fR or \f(CW\*(C`bigint\*(C'\fR, it's assumed to be numeric, while \&\f(CW\*(C`inet\*(C'\fR and \f(CW\*(C`cidr\*(C'\fR (as used by e.g. PostgreSQL) are assumed to be \&\f(CW\*(C`cidr\*(C'\fR format. .SH METHODS .IX Header "METHODS" .SS ip_class .IX Subsection "ip_class" .ie n .IP "Arguments: $class" 4 .el .IP "Arguments: \f(CW$class\fR" 4 .IX Item "Arguments: $class" .PP Gets/sets the address class that the columns should be inflated into. The default class is NetAddr::IP. .SS ip_format .IX Subsection "ip_format" .ie n .IP "Arguments: $format" 4 .el .IP "Arguments: \f(CW$format\fR" 4 .IX Item "Arguments: $format" .PP Gets/sets the name of the method used to deflate the address for the database. This must return a value suitable for \f(CW\*(C`$ip_class\-\*(C'\fR\fBnew()\fR; The default format is \f(CW\*(C`addr\*(C'\fR, which returns the address in dotted-quad notation. See "Methods" in NetAddr::IP for suitable values. .SS register_column .IX Subsection "register_column" Chains with "register_column" in DBIx::Class::Row, and sets up IP address columns appropriately. This would not normally be called directly by end users. .SH AUTHOR .IX Header "AUTHOR" Dagfinn Ilmari Mannsåker, \f(CW\*(C`\*(C'\fR .SH BUGS .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-dbix\-class\-inflatecolumn\-ip at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH SUPPORT .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc DBIx::Class::InflateColumn::IP .Ve .PP You can also look for information at: .IP \(bu 4 AnnoCPAN: Annotated CPAN documentation .Sp .IP \(bu 4 CPAN Ratings .Sp .IP \(bu 4 RT: CPAN's request tracker .Sp .IP \(bu 4 Search CPAN .Sp .SH "SEE ALSO" .IX Header "SEE ALSO" DBIx::Class, NetAddr::IP .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2007 Dagfinn Ilmari Mannsåker, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.