#!/usr/bin/perl
use Test::More tests => 2;
use Test::Data qw(Function);
sub fooey($$) { 1 }
prototype_ok( &fooey, '$$', 'Double scalar fooey' );
prototype_ok( &fooey, '$$' );
gives an error as 1..2
Type of arg 1 to Test::Data::Function::prototype_ok must be sub (not subroutine
entry) at func.pl line 10, near "'Double scalar fooey' )"
Type of arg 1 to Test::Data::Function::prototype_ok must be sub (not subroutine
entry) at func.pl line 11, near "'$$' )"
Execution of func.pl aborted due to compilation errors.
Edit by [BazB]: change title from "Query"
You need to backslash the subs so as to pass a reference to them, not call them.
prototype_ok( \&fooey, '$$', 'Double scalar fooey' ); prototype_ok( \&fooey, '$$' );
And yes, the t\function.t has it wrong, as is the POD description for prototype_ok().
perlmonks.org content © perlmonks.org and Anonymous Monk, BrowserUk
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03