From f34b3f836cf1aa3fb7657beccc6b497c03c52f1b Mon Sep 17 00:00:00 2001 From: brian d foy Date: Tue, 9 Jan 2024 13:34:28 -0500 Subject: [PATCH] need to define the prototyped sub before using it --- t/import.t | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/t/import.t b/t/import.t index 3278101..be75756 100644 --- a/t/import.t +++ b/t/import.t @@ -1,10 +1,8 @@ -use Test::More +use Test::More; use Object::Iterate qw(imap igrep iterate); -prototype_ok( &main::imap, '&$' ); -prototype_ok( &main::igrep, '&$' ); -prototype_ok( &main::iterate, '&$' ); - +# since we are using a prototype here, the sub definition needs to +# come before we use the sub sub prototype_ok(\&$;$) { my( $sub, $prototype, $name ) = @_; $name ||= 'function prototype is correct'; @@ -21,4 +19,9 @@ sub prototype_ok(\&$;$) { } } +prototype_ok( &main::imap, '&$' ); +prototype_ok( &main::igrep, '&$' ); +prototype_ok( &main::iterate, '&$' ); + + done_testing();