From: Matt S Trout Date: Sun, 27 May 2012 15:46:12 +0000 (+0000) Subject: point out how easy it is to move from override to around X-Git-Tag: v0.091008~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=13e41b70f5b1b0f9b8b021bd61cb00273dee9a7b;p=gitmo%2FMoo.git point out how easy it is to move from override to around --- diff --git a/Changes b/Changes index 3e33d5c..632d0cf 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ + - document override -> around translation - use D::GD if installed rather than re-adding it as a requirement 0.091007 - 2012-05-17 diff --git a/lib/Moo.pm b/lib/Moo.pm index 7d076c9..27242db 100644 --- a/lib/Moo.pm +++ b/lib/Moo.pm @@ -588,9 +588,21 @@ provide a metaprotocol. However, if you load L, then will return an appropriate metaclass pre-populated by L. -No support for C, C, C, or C - override can -be handled by around albeit with a little more typing, and the author considers -augment to be a bad idea. +No support for C, C, C, or C - the author +considers augment to be a bad idea, and override can be translated: + + override foo => sub { + ... + super(); + ... + }; + + around foo => sub { + my ($orig, $self) = (shift, shift); + ... + $self->$orig(@_); + ... + }; The C method is not provided by default. The author suggests loading L into C (via C for example) and