Merge 'trunk' into 'DBIx-Class-resultset'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Manual / Cookbook.pod
index 48edc40..c1fd262 100644 (file)
@@ -110,4 +110,23 @@ illustrate:
        # book2author table equals the bookID of the books (using the bookID 
        # relationship table
 
+=head2 Setting default values
+
+It's as simple as overriding the C<new> method. Note the use of C<next::method>.
+
+    sub new {
+        my( $class, $attrs ) = @_; 
+        
+        $attrs->{ foo } = 'bar' unless defined $attrs->{ foo };
+        
+        $class->next::method( $attrs );
+    }
+
+=head2 Stringification
+
+Deploy the standard stringification technique by using the C<overload> module. Replace
+C<foo> with the column/method of your choice.
+
+    use overload '""' => 'foo', fallback => 1;
+
 =back