From: Dave Rolsky Date: Sun, 3 May 2009 18:06:01 +0000 (-0500) Subject: Minor code tweaks in the FAQ X-Git-Tag: 0.78~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d8e332d520b25912bfaa7624123823a37badad3c;p=gitmo%2FMoose.git Minor code tweaks in the FAQ --- diff --git a/lib/Moose/Cookbook/FAQ.pod b/lib/Moose/Cookbook/FAQ.pod index 742d63a..b8f372a 100644 --- a/lib/Moose/Cookbook/FAQ.pod +++ b/lib/Moose/Cookbook/FAQ.pod @@ -144,7 +144,7 @@ some basic sample code for inflating a L object: coerce 'DateTime' => from 'Str' - => via { DateTime::Format::MySQL->parse_datetime($_) }; + => via { DateTime::Format::MySQL->parse_datetime($_) }; has 'timestamp' => (is => 'rw', isa => 'DateTime', coerce => 1); @@ -169,7 +169,7 @@ is to add an C modifier to your accessor: my $next = shift; my ($self, $timestamp) = @_; # assume we get a DateTime object ... - $next->($self, $timestamp->epoch); + $self->$next( $timestamp->epoch ); }; It is also possible to do deflation using coercion, but this tends