From: Ash Berlin Date: Tue, 27 May 2008 10:41:44 +0000 (+0000) Subject: Update FAQ to mention behavour of scalar refs w.r.t. update X-Git-Tag: v0.08240~448 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e338dbecfeed34d9dbc8a6c17f0684bf77c03c8e;p=dbsrgits%2FDBIx-Class.git Update FAQ to mention behavour of scalar refs w.r.t. update --- diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index a50865c..8fcc313 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -357,6 +357,19 @@ scalar reference: ->update({ somecolumn => \'othercolumn' }) +But note that when using a scalar reference the column in the database +will be updated but when you read the value from the object with e.g. + + ->somecolumn() + +you still get back the scalar reference to the string, B the new +value in the database. To get that you must refresh the row from storage +using C. Or chain your function calls like this: + + ->update->discard_changes + + to update the database and refresh the object in one step. + =item .. store JSON/YAML in a column and have it deflate/inflate automatically? You can use L to accomplish YAML/JSON storage transparently.