Christopher G Tantalo wrote:
Hello,
    In a recent perl script I wrote, I have a procedure, read_config(),
which reads a
config file I have set up and sets a hash to what is in the file.  Now,
before you
mention it, I have stricts on and use the -w on the 1st line, and the
following
message appears.

main::read_config() called too early to check prototype at
./eleadtest.pl line 19.

What does this mean?  Code snippets of the procedure call, and the
procedure itself
are below.


In general Perl does not expect you to do strong typing of the arguments you pass into a subroutine so there is no need to use prototyping. Because you defined your subroutine using '()' Perl thinks you are trying to use prototyping, in which case you are calling the sub to early. So either you need to pre-declare the subroutine or simply not use a blank prototype... so instead of:


sub read_config()
{
> #blah blah blah
}

use:


sub read_config
{
# blah blah blah
}

For much more on subroutines and prototyping have a look at:

perldoc perlsub

In general the order of subroutine definition does not matter, or its placement in the file, with the exception of prototype'd functions which is what you ran into.

http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to