Batara Kesuma wrote:
Hi,

I tried using ModPerl::Registry with this piece of CGI code:

#!/usr/bin/perl -w

use CGI;
use strict;
my $cgi = CGI::->new;
print $cgi->header;
our $count = 0;
for (1 .. 5) {
    increase_count();
}
sub increase_count {
    our $count;
    $count++;
    print $count . "<br>\n";
}

It gave me this error:
Subroutine increase_count redefined at /var/www/perl/test.pl line 12.

What is the problem?

You must have changed the script, Registry.pm has recompiled it, which has redefined the subroutine, and you've received the appropriate warning. If you don't wish this to happen, you can say:


no warnings 'redefine';

at the top of your script.

Normally I start my code with:

use strict;
use warnings;
no warnings 'redefine'; # to be remove in production

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to