This feature just plain doesn't exist is what everyone is saying. Perl is,
as Uri pointed out, a very dynamic language. More so than languages that are
just dynamically typed. Perl has strict that restricts the language some,
like requiring you to define your variables, but it doesn't work for subs. I
don't know the particulars of why not exactly. I imagine that it's just
harder to provide that option due to autoload and begin being in the
language.
If you really need to do something like this you might have to actually
get a hold of a Perl parser and write the static checker on your own. Or
if you are working in a setting where any static analysis at all is
necessary perhapse Perl is not the language for you. Perl just doesn't have
it.
-mike
On Tue, Jul 19, 2005 at 10:44:36AM -0400, Kripa Sundar wrote:
> Dear Uri,
>
> > but perl can't divine if subs exist before they are called because some
> > module may do things differently. just look at AUTOLOAD.
>
> I think I haven't communicated my desired feature clearly.
>
> I am not asking perl to divine anything about run-time availability of
> definitions. I explicitly don't want to rely on dynamically defined
> subs.
>
> All I am asking for is this: I want perl *not* to "hope" that a
> definition will be available at the time of invoking a subroutine.
> I want perl to tell me up front, if the code that it received for
> compilation is missing a sub definition.
>
> When perl is done with all its compilation, juuuuuust before starting
> execution of the compiled code, it should verify that every invoked
> subroutine has a definition. If a definition is missing, perl should
> immediately die with a suitable error message. I don't need this check
> to happen as soon as the invocation is seen by the compiler. I only
> need it to happen after all compilation is complete.
>
> > but will that honor modules that are used? [...]
>
> I cannot phrase my point any better than the previous time around.
> So I'll pretty much repeat myself.
>
> The user is asking perl to flag some *legal* usage as being
> unacceptable for her/his purpose. This is no different from any other
> stricture.
>
> If it means that the pragma is incompatible with many extant modules,
> that is life. "use 5.008" is presumably incompatible with many
> modules, too.
>
> peace, || Udayachal: a newspaper edited by slum children:
> --{kr.pA} || http://tinyurl.com/57jaf
> --
> This .sig intentionally left blank.
>
> _______________________________________________
> Boston-pm mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/boston-pm
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm