@mst: so I don't have to load PK::Auto anymore? At the moment I only load it for table classes which have a sequence name defined to prevent an error I had some time ago...
-Alex > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:dbix-class- > [EMAIL PROTECTED] On Behalf Of Matt S Trout > Sent: Saturday, September 30, 2006 6:20 PM > To: [EMAIL PROTECTED]; [email protected] > Subject: Re: [Dbix-class] Problem with using InflateColumn::DateTime > > J Cook wrote: > > Hi, > > > > I'm trying to reformat a date field from a MySQL table - wanting to go > > from yyyy-mm-dd to mm/dd/yyyy when displayed on a webpage. So, > following > > some advice I did the following: > > > > package DB::Main::Book; > > > > use base qw/DBIx::Class/; > > > > # Load required DBIC stuff > > __PACKAGE__->load_components(qw/PK::Auto Core > InflateColumn::DateTime/); > > # Set the table name > > __PACKAGE__->table('books'); > > # Set columns in table > > __PACKAGE__->add_columns(date => { data_type => 'date' }); > > __PACKAGE__->add_columns(qw/id book author date/); > > # # Set the primary key for the table > > __PACKAGE__->set_primary_key('id'); > > > > Next in my code(Mason page): > > <% $quote->depart_date->mdy() %> depart date<br> > > > > I get the following result: > > > > Can't call method "mdy" without a package or object reference at > > > > > > It works fine without the '->mdy()' but of course doesn't format the > > date as wished for. > > > > I followed the doc and I've tried several variations but this looks > like > > it should work according to how the doc looks. > > > > Any suggestions? > > __PACKAGE__->load_components(qw/PK::Auto Core InflateColumn::DateTime/); > > should be > > __PACKAGE__->load_components(qw/InflateColumn::DateTime Core/); > > PK::Auto is in Core as of 0.07, but left-most loaded component is most > significant so without putting InflateColumn::DateTime to the left of > Core its > overrides won't be seen. > > -- > Matt S Trout Offering custom development, consultancy and > support > Technical Director contracts for Catalyst, DBIx::Class and BAST. > Contact > Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more > information > > + Help us build a better perl ORM: http://dbix- > class.shadowcatsystems.co.uk/ + > > _______________________________________________ > 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/dbix- > [EMAIL PROTECTED]/ *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* _______________________________________________ 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]/
