<div dir="ltr"><div><div><div><div>Hi,<br><br>I am trying to write an inflator that will produce a NetAddr::IP object from my form input. I have searched for but been unable to find much information about writing custom inflators. If there are examples or additional documentation available, links would be greatly appreciated.<br><br>I am working on my first Catalyst web site with DBIC and FormFu. I am using the built-in Catalyst server to display the web pages. The whole thing is running on a CentOS 7.5 VM on one of my servers.<br><br>I took a look at the source for the core inflators and from what I (mis)understand of the code, the inflator provides an inflator method that returns on failure or returns the inflated object upon success. I have written the following but it does not work as I expected.<br><br><span style="font-family:monospace,monospace">package HTML::FormFu::Inflator::NetAddr::IP;<br>use Moose;<br>use HTML::FormFu::Constants qw( $EMPTY_STR );<br>use NetAddr::IP;<br>use namespace::autoclean;<br><br>extends &#39;HTML::FormFu::Inflator&#39;;<br><br>sub inflator {<br>    my ( $self, $value ) = @_;<br><br>    return if !defined $value || $value eq $EMPTY_STR;<br><br>    my $ip = NetAddr::IP-&gt;new($value);<br>    return if !defined $ip;<br><br>    return $ip;<br>}<br><br>__PACKAGE__-&gt;meta-&gt;make_immutable;<br><br>1;</span><br><br></div>With the following form config...<br><br><span style="font-family:monospace,monospace">  # Text box for the network subnet address<br>  - type: Text<br>    name: subnet<br>    label: Subnet<br>    attributes:<br>      title: Enter the Subnet Address for this network in CIDR format.<br>    inflators:<br>      - type: NetAddr::IP<br>        message: Not a valid subnet address.<br></span><br></div>Even when I enter a valid address that should be inflatable, such as <a href="http://10.255.255.0/24">10.255.255.0/24</a>,  I get the &#39;Not a valid subnet address&#39; error message.<br><br></div>Any help or redirection would be appreciated.<br><br></div>Bill<br><br><div><div><br><br></div></div></div>