Skip to content

Commit addc11f

Browse files
committed
prevent PPI::Normal->register from registering duplicates
1 parent 2fcee5a commit addc11f

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

lib/PPI/Normal.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ sub register {
8686
}
8787

8888
# Has it already been added?
89-
if ( List::Util::any { $_ eq $function } ) {
89+
if ( List::Util::any { $_ eq $function } map @{$_}, values %LAYER ) {
9090
return 1;
9191
}
9292

t/09_normal.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,5 @@ NO_DOUBLE_REG: {
5858
is $PPI::Normal::LAYER{2}[-1], "main::just_a_test_sub", "and find subs at right layer";
5959
my $size = @{ $PPI::Normal::LAYER{2} };
6060
ok( PPI::Normal->register( "main::just_a_test_sub", 2 ), "can add subs again" );
61-
local $TODO = 'prevent duplicate registrations of normals';
6261
is scalar @{ $PPI::Normal::LAYER{2} }, $size, "but sub isn't added twice";
6362
}

0 commit comments

Comments
 (0)