There's no way to do this. Perl is a dynamic language, and functions
are added to packages at runtime all the time. Consider that
subclassing happens on-the-fly with @ISA (rarely put inside a BEGIN
block), and that AUTOLOAD means a package (or a class's ancestor)
might decide to handle -- or decline -- some call, pretty much
arbitrarily.

On Thu, Sep 23, 2010 at 1:46 PM, Ronen Angluster <[email protected]> wrote:
> Hello all,
> please consider the following code:
> ###################################
> package main;
> my $x= main::foo->new();
> $x->bar();
> $x->barx();
> package foo;
> sub new {
> my $this = shift;
> my $class = ref($this) || $this;
> my $self={};
> bless ($self, $class);
> return $self;
> }
> sub bar
> {
> my $self = shift;
> print "foo\n";
> }
> #################################
> now, executing this code with "perl -cw script.pl" will not produce any
> errors since the call for theĀ referenceĀ of "barx" will only
> be evaluated during runtime.
> is there a way to detect such errors in compile time?
> Hag Sameach,
> Ronen
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
Gaal Yahas <[email protected]>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to