[Dbix-class] modfiying data on retrieval
Dave Howorth
dhoworth at mrc-lmb.cam.ac.uk
Mon Mar 5 14:42:59 GMT 2007
Will Hawes wrote:
> On 05/03/07, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> wrote:
>> I need to read data from a database where fields have been entered by
>> hand and have miscellaneous extraneous leading and trailing whitespace.
>>
>> I think the best approach is to suppress these characters as I retrieve
>> the fields from the database, so I guess I need to override some method
>> (in my Schema ?) but I haven't figured out which.
>>
>> I've looked around in the Cookbook and FAQ without spotting anything.
>> Could somebody give me a pointer to the right place?
>>
>> Thanks, Dave
>
> Wouldn't you just override the relevant accessors in your model
> classes to do this?
I'm not quite sure what 'model classes' means in this context? I don't
think I want to override individual accessors; I think I want to
override whatever they inherit from (the equivalent of CDBI's get()
method). I just don't know where to read up about how to do that.
Cheers, Dave
FWIW my entire DBIC code (apart from the application's usage) is below:
#!/usr/bin/perl
use strict;
use warnings;
package SU::Schema;
our $VERSION = 0.01;
# 2006-06-23 djh v0.01 Created
use base qw/DBIx::Class::Schema::Loader/;
my $dsn = 'dbi:mysql:host=cpepc210-2;database=scopupdate';
__PACKAGE__->loader_options(
relationships => 1,
# debug => 1,
);
1;
More information about the Dbix-class
mailing list