From: Nick Woolley Date: Mon, 30 Mar 2009 10:40:59 +0000 (+0100) Subject: Modified glob asignment to be coderef assignment. As suggested by X-Git-Tag: 0.20~58 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=bded4514c62681d1c38503835c30a6b76b8b7c80 Modified glob asignment to be coderef assignment. As suggested by GFUGI in a comment attached to RT #42992. Indeed, we probably don't want to clobber package variables the role may have defined with the same name as a method. --- diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index f7ebd21..13a27d8 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -101,7 +101,7 @@ sub apply { if ($args{alias} && $args{alias}->{$name}) { my $dstname = $args{alias}->{$name}; unless ($classname->can($dstname)) { - *{"${classname}::${dstname}"} = *$role_function; + *{"${classname}::${dstname}"} = \&$role_function; } } } @@ -192,7 +192,7 @@ sub combine_apply { if ($args{alias} && $args{alias}->{$name}) { my $dstname = $args{alias}->{$name}; unless ($classname->can($dstname)) { - *{"${classname}::${dstname}"} = *$role_function; + *{"${classname}::${dstname}"} = \&$role_function; } } }