Skip to content

Commit 1ed4385

Browse files
committed
fix for/for_class parameter that don't match between doc and code
The documentation describing the apply_base_class_role() method of the Mouse::Util::MetaRole package, and other similar methods, explains that it takes "for" parameter. However, they actually take a parameter with the name "for_class", which can be confusing to users and needs to be fixed. So in the apply_base_class_role() method, we also use the _fixup_old_style_args() function to convert the old parameter style to the current one. Signed-off-by: Jihyeon Gim <[email protected]>
1 parent 08624d0 commit 1ed4385

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Moose-t-failing/050_metaclasses/050_metarole_backcompat.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ use Mouse::Util::MetaRole;
223223

224224
{
225225
Mouse::Util::MetaRole::apply_base_class_roles(
226-
for_class => 'My::Class',
227-
roles => ['Role::Foo'],
226+
for => 'My::Class',
227+
roles => ['Role::Foo'],
228228
);
229229

230230
ok( My::Class->meta()->does_role('Role::Foo'),

lib/Mouse/Util/MetaRole.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ sub _fixup_old_style_args {
104104
return;
105105
}
106106

107-
108107
sub apply_base_class_roles {
109108
my %options = @_;
110109

111-
my $for = $options{for_class};
110+
_fixup_old_style_args(\%options);
111+
112+
my $for = $options{for};
112113

113114
my $meta = Mouse::Util::class_of($for);
114115

0 commit comments

Comments
 (0)