DBIx::...mn::IP(3pm)
β¨ NAME β¨
DBIx::Class::InflateColumn::IP β the component that auto-creates NetAddr::IP objects from your columns. no cap, your database column just becomes a real IP object the second you touch it π¦
πΈ SYNOPSIS πΈ
okay so bestie, first you load this component and then you declare your columns as IP addresses with the right format. it's giving setup era β¨
package Host;
__PACKAGE__->load_components(qw/InflateColumn::IP Core/);
__PACKAGE__->add_columns(
ip_address => {
data_type => 'bigint',
is_nullable => 0,
is_ip => 1,
ip_format => 'numeric',
}
);
package Network;
__PACKAGE__->load_components(qw/InflateColumn::IP Core/);
__PACKAGE__->add_columns(
address => {
data_type => 'varchar',
size => 18
is_nullable => 0,
is_ip => 1,
ip_format => 'cidr',
}
);
and then?? you just treat that column like a NetAddr::IP object. that's it. that's the whole vibe π
print 'IP address: ', $host->ip_address->addr;
print 'Address type: ', $host->ip_address->iptype;
DBIx::Class::InflateColumn::IP also does a limited amount of auto-detection of the format based on the column type, because it's thoughtful like that π
- if the type starts with
intorbigint, it's assumed to be numeric - if the type is
inetorcidr(like the ones PostgreSQL uses), it's assumed to becidrformat
π METHODS π
π§ ip_class
Arguments: $class
Gets/sets the address class that the columns get inflated into. the default class is NetAddr::IP. she's the moment, she's the blueprint π
π¦ ip_format
Arguments: $format
Gets/sets the name of the method used to deflate the address for the database. so like, it has to return a value suitable for $ip_class->new() β no exceptions, she's picky π
the default format is addr, which returns the address in dotted-quad notation. for other suitable values, go peek at "Methods" in NetAddr::IP. iykyk π
π register_column
Chains with register_column in DBIx::Class::Row, and sets up your IP address columns appropriately. fr fr, this would not normally be called directly by end users β that's backend business, stay in your lane bestie π
π«Ά AUTHOR π«Ά
Dagfinn Ilmari MannsΓ₯ker, "<ilmari at ilmari.org>" β icon, legend, the blueprint π
π BUGS π
Please report any bugs or feature requests to "bug-dbix-class-inflatecolumn-ip at rt.cpan.org", or slide through the web interface at:
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-InflateColumn-IP>
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. bestie you get live updates, we love a two-way street β¨
π SUPPORT π
You can find documentation for this module with the perldoc command:
perldoc DBIx::Class::InflateColumn::IP
You can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/DBIx-Class-InflateColumn-IP>
- CPAN Ratings
<http://cpanratings.perl.org/d/DBIx-Class-InflateColumn-IP>
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-InflateColumn-IP>
- Search CPAN
<http://search.cpan.org/dist/DBIx-Class-InflateColumn-IP>
π₯ SEE ALSO π₯
DBIx::ClassNetAddr::IP
the whole squad, obsessed π«Ά
π COPYRIGHT & LICENSE π
Copyright 2007 Dagfinn Ilmari MannsΓ₯ker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's a wrap, bestie π this page came from the User Contributed Perl Documentation for DBIx::Class::InflateColumn::IP, rendered with perl v5.38.2 and dated 2024-02-21. go forth and inflate responsibly π¦β¨
π¦ where this page comes from
- debian trixie: libdbix-class-inflatecolumn-ip-perl 0.02003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbix-class-inflatecolumn-ip-perl 0.02003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-class-inflatecolumn-ip-perl 0.02003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-class-inflatecolumn-ip-perl 0.02003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms