[Israel.pm] Detecting calls for unknown methods in compile time

Ronen Angluster beerholder at gmail.com
Thu Sep 23 04:46:55 PDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100923/ef005cf5/attachment.htm 


More information about the Perl mailing list