runrig has asked for the wisdom of the Perl Monks concerning the following question:
Output:#!/usr/bin/perl use strict; use warnings; my $i = 0; main(); sub main { exit if $i++ > 10; print "Calling foo()\n"; foo(); } sub foo { print "foo()\n"; my $fn = main->can("bar") or return; print "We can bar\n"; $fn->(); } __END__
Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo() Calling foo() foo()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class->can() bug or user error
by chromatic (Archbishop) on Jul 15, 2011 at 19:21 UTC | |
|
Re: Class->can() bug or user error
by ikegami (Patriarch) on Jul 15, 2011 at 19:17 UTC | |
|
Re: Class->can() bug or user error
by runrig (Abbot) on Jul 18, 2011 at 16:00 UTC |