This is not correct. That code is executed when the module is loaded for the first time (in a CGI environment, it will presumably be loaded each time a CGI script runs because each one is a separate Perl process). See use and require as well as the "Perl Modules" section of perlmod.
The OP did not tell us what he/she means in saying the module doesn't work, but my guess is that it is not writing the log or writing it to the wrong place. Fundamentally, the rule of thumb I'd suggest is don't use cwd() in CGI programs. Instead, explicitly set the directory for the log file, either hard-coded or stored in a confirguration file in a fixed location.
In reply to Re^2: Error Module not working in Browser, Help!
by Errto
in thread Error Module not working in Browser, Help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |