Skip to content

Commit

Permalink
need to define the prototyped sub before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
briandfoy committed Jan 9, 2024
1 parent 3855053 commit f34b3f8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions 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';
Expand All @@ -21,4 +19,9 @@ sub prototype_ok(\&$;$) {
}
}

prototype_ok( &main::imap, '&$' );
prototype_ok( &main::igrep, '&$' );
prototype_ok( &main::iterate, '&$' );


done_testing();

0 comments on commit f34b3f8

Please sign in to comment.