DBIx::...mn::IP(3pm)

πŸ“¦
version 0.02003 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 int or bigint, it's assumed to be numeric
  • if the type is inet or cidr (like the ones PostgreSQL uses), it's assumed to be cidr format

πŸ‘‘ 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::Class
  • NetAddr::IP

the whole squad, obsessed 🫢


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