Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: I'm in trouble with Perl's OO programming

by chromatic (Archbishop)
on Jun 09, 2005 at 17:32 UTC ( #465217=note: print w/replies, xml ) Need Help??


in reply to Re: I'm in trouble with Perl's OO programming
in thread I'm in trouble with Perl's OO programming

That will actually call the methods at the point of definition, not in the loop. I think you meant instead:

$self->addTab( sub { $self->WatchLog() } );

Another option is to provide the name of methods to call:

$self->addTab( 'WatchLog' );

and then call them with:

$self->$code()

That's really late binding and it can be useful.

Replies are listed 'Best First'.
Re^3: I'm in trouble with Perl's OO programming
by guha (Priest) on Jun 09, 2005 at 20:30 UTC

    You are right! I thoroughly misunderstood the OP.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://465217]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2021-03-01 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (4 votes). Check out past polls.

    Notices?