Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 87315
Status: resolved
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.003000
Fixed in: 1.003001



Subject: Sub::Quote doesn't close over its captured variables
It makes a shallow copy of them instead. The attached test case illustrates the issue. It's possible that the current behaviour is intentional, but if so I think it really needs to be documented.
Subject: sub-quote-closures.t
use strict; use warnings; use Test::More; use Sub::Quote; my $sound = 0; quote_sub 'Silly::dagron', q{ return(++$sound % 2 ? 'burninate' : 'roar') }, { '$sound' => \$sound }; is(Silly::dagron(), 'burninate'); is(Silly::dagron(), 'roar'); is(Silly::dagron(), 'burninate'); is(Silly::dagron(), 'roar'); is($sound, 4, '$sound successfully closed over'); done_testing;
Clarified in the documentation that no aliasing is involved.
Fixed in Moo 1.003001.