use NetAddr::IP; __PACKAGE__->has_a( ip_addr => 'NetAddr::IP' inflate => sub { my $packed = shift; # Unpack the IP addr here into $ip and $netmask return NetAddr::IP->new( $ip, $netmask ); }, deflate => sub { my $addr = shift; # Take the NetAddr::IP instance and pack it # into $packed return $packed; }, );