Skip to content

Commit 8d827fe

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. And also, other packages may already be calling the apply_base_class_role() method and using the name “for_class”, so I've allowed them to do so to maintain compatibility. Signed-off-by: Jihyeon Gim <[email protected]>
1 parent 08624d0 commit 8d827fe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ sub _fixup_old_style_args {
108108
sub apply_base_class_roles {
109109
my %options = @_;
110110

111-
my $for = $options{for_class};
111+
my $for = $options{for} // $options{for_class};
112112

113113
my $meta = Mouse::Util::class_of($for);
114114

0 commit comments

Comments
 (0)