Hi all,
I am new to mod_perl and i have one problem<br>
I want to rewrite this simple script from fastcgi to
mdo_perl
---------
use FCGI;
$cnt = 0;
while (FCGI::Accept)
{
print "Content-type:text/html\n\n";
print $cnt++;
}
---------
This script writes (when i relaod it) 1,2,3,4,5,...
and $cnt is "global variable"
in mod_perl
I created My.pm package
-----------
package My;
use strict;
use Apache::Constants qw(:common);
# I try both global variable possibilites
use vars qw($cnt1);
$My::cnt2 = 1;
my $cnt1 = 1;
sub increment{
$My::cnt2++;
$cnt++;
print "$cnt1<br>";
print $My::cnt2;
}
1;
-----------
I have this module in starup.pl and start it when
apache start
I also have a script when i use My.pm module
-----------
#!/usr/bin/perl -w
use strict;
use Apache::Registry;
use My;
print "Content-type:text/html\n\n";
$rr = Myy->increment();
print "<br>$rr<br>";
-----------
This script writes 1,1,1,2,2,2,3,3,3,2,2,3,4,2,1 .....
randomly !!
Can anybody help me, where is the problem ?
Thanks a lot
Tomas Zeman
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/