in reply to Re^2: $self->do_it("now") question
in thread $self->do_it("now") question
very strange
Not really; it's fairly normal in a dynamic language like Perl. Like choroba already said, sub names can be autoloaded or dynamically created. Note how in the following two examples, there is no obvious (greppable) place that do_it is defined.
sub AUTOLOAD { print "Hello!\n" } do_it(); __END__ Hello!
my $x = "do_"; my $y = "it"; { no strict 'refs'; *{"$x$y"} = sub { print "Hello!\n" }; } do_it(); __END__ Hello!
|
|---|