On Fri, 2010-02-26 at 09:21 -0500, Steve wrote: > I have been attempting to solve the following problem: > > I have a class, 'UsageDetail' which takes a CSV phone call record and > inserts it into my database. One of the attributes, 'WirelessNumber' > has dashes in it, ie: '989-555-1212'. I don't want to store the dashes > in the db. I've rtfm over and over, but I haven't been successful in > storing without the dashes. I've tried subtypes, but that didn't work. > BTW, the values passed in to my constructor are not ONLY the 3-3-4 digit > format, sometimes the wireless number is 2 digits, and my WirelessNumber > attr. isa 'Str' currently. Also, I can't modify the value passed into > my constructor, as it is used for many different tables. Any > suggestions are greatly appreciated. > > Steve
If you are using DBIx::Class, then you can add something like the following in Schema/Result/UsageDetail.pm: sub update/create { my ($class, $args) = @_; $args->{'wireless-no'} =~ s/-//g if exists $args->{'wireless-no'}; return $class->next::method($args); } -- Kiffin Gish <kiffin.g...@planet.nl> Gouda, The Netherlands