Discussion:
called too early?
Bryan Harris
2006-08-29 22:50:37 UTC
Permalink
I'm getting this warning in a simple script I'm writing:

**************************************
main::overlap() called too early to check prototype at
/Users/bh/Library/perl/popdef line 272.
**************************************

The subroutine "overlap" is at the bottom of the script, but so are several
others, and I don't get warnings on those. What causes this kind of
warning?

TIA.

- Bryan
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Owen Cook
2006-08-29 22:59:42 UTC
Permalink
Post by Bryan Harris
**************************************
main::overlap() called too early to check prototype at
/Users/bh/Library/perl/popdef line 272.
**************************************
The subroutine "overlap" is at the bottom of the script, but so are several
others, and I don't get warnings on those. What causes this kind of
warning?
perldoc perldiag

%s() called too early to check prototype

(W prototype) You've called a function that has a prototype before the
parser saw a definition or declaration for it, and Perl could not check
that the call conforms to the prototype. You need to either add an early
prototype declaration for the subroutine in question, or move the
subroutine definition ahead of the call to get proper prototype
checking. Alternatively, if you are certain that you're calling the
function correctly, you may put an ampersand before the name to avoid the
warning.



Owen
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
John W. Krahn
2006-08-29 23:58:01 UTC
Permalink
Post by Bryan Harris
**************************************
main::overlap() called too early to check prototype at
/Users/bh/Library/perl/popdef line 272.
**************************************
The subroutine "overlap" is at the bottom of the script, but so are several
others, and I don't get warnings on those. What causes this kind of
warning?
Using prototypes. Don't use prototypes:

http://library.n0i.net/programming/perl/articles/fm_prototypes/



John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Loading...