isync has asked for the wisdom of the Perl Monks concerning the following question:

I am looking for the correct stage on the app-init, to place my code to do some checks and inits.

What is the right stage to do calls to initialize settings or do things like comparing time() with an expire date.

My best bet so far was to place it in App->new, but at this stage the $this /$self var has not yet been properly initialized. rough code steps:
package main; my $app = AppMain->new(); $app->MainLoop(); 1; package AppMain; sub OnInit{ my $frame = App->new() 1; } 1; package App; sub new{ ## here is not right... } 1;

Replies are listed 'Best First'.
Re: Wx:: the right stage to do things like has_expired() on init?
by isync (Hermit) on Aug 28, 2008 at 13:26 UTC
    Found it out myself:

    Actually
    package App; sub new{ ## > here IS RIGHT! } 1;
    you just have to make sure that you do not access things (for example TextCtrls) that haven't been created. As most of this stuff is established in this new() routine, make sure to place your has_expired()-like routines at the end of new() after all you are working with is actually there...