From 5f5ea5b446c9c4238cc06cde71e1fddc3cc7f31f Mon Sep 17 00:00:00 2001 From: Toby Inkster Date: Mon, 4 Jul 2022 00:34:53 +0100 Subject: [PATCH] no warnings once; fixes #2 --- lib/Role/Hooks.pm | 1 + t/99nonrole.t | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 t/99nonrole.t diff --git a/lib/Role/Hooks.pm b/lib/Role/Hooks.pm index 2049be3..bc44b85 100644 --- a/lib/Role/Hooks.pm +++ b/lib/Role/Hooks.pm @@ -71,6 +71,7 @@ sub is_role { } no strict 'refs'; + no warnings 'once'; my $UM = ${"$target\::USES_MITE"}; if ( defined $UM and $UM eq 'Mite::Role' ) { return 'Mite::Role'; diff --git a/t/99nonrole.t b/t/99nonrole.t new file mode 100644 index 0000000..3c38153 --- /dev/null +++ b/t/99nonrole.t @@ -0,0 +1,12 @@ +use strict; +use warnings; +use Test::More; +use Role::Tiny; + +BEGIN { + package Foo; + sub new { bless [], shift } +}; + +ok ! Role::Tiny->is_role( 'Foo' ); +done_testing;