assuring that all subroutines are defined

John R. Comeau comeaujr at
Thu May 18 13:23:52 CDT 2000

I asked a couple of people about this at the SDPM meeting last night.
The question is how you can be certain that all subroutines called by
your program actually exist.  That is, I'd like a way to find out if
any subroutines are undefined as soon as the program starts to run
instead of waiting until much later when the subroutine is actually
called to find out.

I know this presents somewhat of a problem since new subroutines can
be eval'ed into existence like the following:

    my $sub_definition = 'sub mysub {print "hello\n"}';
    eval $sub_definition;

So it would be difficult for the Perl compiler to know beforehand
whether a given subroutine will exist at the time it's called.

But disregarding this, is there some way to make Perl check that all
subroutines are defined?

By the way, neither 'use strict' nor 'perl -w' guards against
undefined subroutines.


The posting address is: san-diego-pm-list at

List requests should be sent to: majordomo at

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at> .
This is the general rule for most mailing lists when you need
to contact a human.

More information about the San-Diego-pm mailing list