Fix aroun example to handle both read & write cases correctly.
[gitmo/Moose.git] / lib / Moose / Cookbook / FAQ.pod
index b8f372a..3fd9e02 100644 (file)
@@ -167,9 +167,13 @@ is to add an C<around> modifier to your accessor:
 
   around 'timestamp' => sub {
       my $next = shift;
-      my ($self, $timestamp) = @_;
+      my $self = shift;
+
+      return $self->$next unless @_;
+
       # assume we get a DateTime object ...
-      $self->$next( $timestamp->epoch );
+      my $timestamp = shift;
+      return $self->$next( $timestamp->epoch );
   };
 
 It is also possible to do deflation using coercion, but this tends