Sigh. I thought this one was going to be easy. Convert MySQL's native date format (yyyy-m-d) to EU-style (dd-mm-yyyy):

In Schema::Request
__PACKAGE__->load_components(qw/PK::Auto Core InflateColumn::DateTime/);
__PACKAGE__->add_columns( qw/id some_more_columns/ );
__PACKAGE__->add_columns( date => { data_type => 'date' } );

In controller:

while ( my $hits = $rs->next ) {
  push @hits, [
   $hits->date, # OK
   $hits->date->year, # not OK:

"Can't call method "year" without a package or object reference at ... "

Presumably I've missed something not documented in the POD?

On reflection though, maybe InflateColumn is not the correct method for what I really want - to globally reformat date fields to EU format.
--
Richard Jones
Leeds, UK

**********************************************************************
This message  may  contain  confidential  and  privileged information.
If you are not  the intended  recipient please  accept our  apologies.
Please do not disclose, copy or distribute  information in this e-mail
or take any  action in reliance on its  contents: to do so is strictly
prohibited and may be unlawful. Please inform us that this message has
gone  astray  before  deleting it.  Thank  you for  your co-operation.

NHSmail is used daily by over 100,000 staff in the NHS. Over a million
messages  are sent every day by the system.  To find  out why more and
more NHS personnel are  switching to  this NHS  Connecting  for Health
system please visit www.connectingforhealth.nhs.uk/nhsmail
**********************************************************************


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to