Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: Class::DBI - performing action on column before it is used or saved

by hardburn (Abbot)
on Dec 19, 2003 at 21:39 UTC ( [id://315927]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Class::DBI - performing action on column before it is used or saved
in thread Class::DBI - performing action on column before it is used or saved

For IP addresses, I would have them inflate to a NetAddr::IP object:

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; }, );

Using Class::DBI = Good
Using Class::DBI with inflation of many fields to objects = Better (usually)

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://315927]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found