in reply to Re^4: when is a perl module executed?
in thread when is a perl module executed?

You have a series of problems:
  1. the text outside functions in a module is executed at BEGIN time and only once if you use the module; this is because
    use Module;
    is a special way of saying
    BEGIN { require Module; }
    and require only loads each module once (it checks on @INC to see if the modules wasn't already loaded.
  2. as you are under some CGI environment, some possibilities exist: the module was loaded before CGI (so STDOUT wasn't redirected to the browser yet), or you missed the first time you loaded the page and the module was already loaded by perl (and then you won't see it again, even if you reload the page, because the module is already loaded).
  3. You are yet to explain why you want to do this. Maybe if you explain, we can come up with alternatives for you.
[]s, HTH, Massa