Hi Everybody -

   Finally got it working, and I wanted to sum up what I did so if somebody
else runs into this, it'll be waiting for 'em in the archives.

In the startup.pl, here's what I got:

BEGIN{
$ENV{EMBPERL_SESSION_CLASSES} = "DBIStore SysVSemaphoreLocker";
$ENV{EMBPERL_SESSION_ARGS}    = "DataSource=dbi:mysql:gpp8p_casenet
UserName=gpp
8p Password=xxxxx";
}
use Apache::Session::Embperl;
use HTML::Embperl;
$Apache::Session::SysVSemaphoreLocker::nsems = 16;

(note - I'm running Solaris so I gotta have the nsems argument)

The table:

mysql> describe sessions;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id        | varchar(16) |      | PRI |         |       |
| expires   | int(11)     | YES  |     | NULL    |       |
| length    | int(11)     | YES  |     | NULL    |       |
| a_session | text        | YES  |     | NULL    |       |
+-----------+-------------+------+-----+---------+-------+

The test script:

<html>
<h1>Test of session features</h1><hr>
[+ if($udat{counter} == 0){$udat{counter} = 1} +]
The page is requested [+ $udat{counter}++ +] occasions
since [+ $udat{date} ||= localtime +]
<br>
cookies: [+ $ENV{HTTP_COOKIE} +]
</html>


I think that covers it.  Thanks for your help.

                        - George






>George,
>
>This problem was mentioned in a previous post because it is wrong in the
>documentation (it may be fixed now).
>
>The setting of $ENV{EMBPERL...} variables in this case need to be inside
>a BEGIN block at the start of the script. This is because the value of
>these variables are used to setup session tracking right when the
>HTML::Embperl module is used (and this happens before your EMBPERL
>environment variables are being set).
>
>So put a BEGIN {} around them and you should be ready to roll.
>Incidentally if you are using starting and stopping apache by hand you
>will see a message from Embperl when session tracking has been enabled.
>If you do not see the message don't waste your time looking at your test
>page.
>
>Another thing, the reason things update randomly is because each apache
>child is keeping a copy of what you put in $udat. Since it is a special
>Embperl variable it will hold it's value and not be cleaned up at the
>end of page execution like other variables are each time you reload you
>get a different child with a different incrementing number.
>
>-- Owen
>
>"George P. Pipkin" wrote:
>>
>> Hi Everybody -
>>
>>    I have been playing around with Embperl.  I have a little script that
>> resembles the counter test mentioned in the docs, and it appears to
>> run.  Problem is, no cookies get set.  And the value of the counter is
>> erratic.  One browser will appear to pick up the count from another.
>> Then it will jump back.  Here is the script:
>>
>> <html>
>> <h1>Test of session features</h1><hr>
>> [+ if($udat{counter} == 0){$udat{counter} = 1} +]
>> The page is requested [+ $udat{counter}++ +] occasions
>> since [+ $udat{date} ||= localtime +]
>> <br>
>> cookies: [+ $ENV{HTTP_COOKIE} +]
>> </html>
>> ~
>>
>> Incidently, $ENV{HTTP_COOKIE} never shows any value at all.  I have the
>> session mechanics hooked up to a mysql database.  Here's the setup stuff
>> in startup.pl:
>>
>> $ENV{EMBPERL_SESSION_CLASSES} = "DBIStore SysVSemaphoreLocker";
>> $ENV{EMBPERL_SESSION_ARGS}    = "DataSource=dbi:mysql:gpp8p_casenet
>> UserName=gpp
>> 8p Password=xxxxxxx";
>> use Apache::Session;
>> use HTML::Embperl;
>>
>> And BTW, I did set up the two tables in that database....
>>
>> Any ideas ????
>>
>>                                 - George Pipkin
>>
>> --
>>
>>********************************************************************************
>>*******
>> George P. Pipkin                                     h - (804)-245-9916
>> 1001 Emmet St.                                       w - (804)-924-1329
>> Carruthers Hall                                      fax -
>> (804)-982-2777
>> Charlottesville, Va. 22903
>> http://jm.acs.virginia.edu/~gpp8p/
>>
>>********************************************************************************
>>*******


*******************************************************************
George Pipkin
Advanced Technology Group
University of Virginia
(804)-924-1329
*******************************************************************

Reply via email to