You are completely missing the whole point of this: IT IS NOT PURE PERL. Its not. Really.

We used Apache::Session because it worked. It works well. PHP sessions also worked well for us. These two systems were already in place.

Now, we needed them to talk to each other. PHP provides a method to the default session handling functions. Rather than screw with Apache::Session::MySQL (of which we already had a bitch of a time getting installed), we decided the best route to take was to take advantage of PHP's overridable functions. So we did. The key part here (which you seem to disagree with, probably because you haven't researched this very deeply), is that we needed a way to take the php-serialized data and convert it to perl-serialized data.

Thats where the perl script that the php script calls comes in. A php-serialized associative array is passed as a command line argument. A perl module deserializes this structure into a hash. The hash is then serialized with Storable. This string is then updated into the sessions database. A reverse process is done when the session data is extracted. Perl, on the other hand, simply grabs the data using the normal Apache::Session::MySQL.

Yes, its a bit odd, but then it isn't a very normal task. Using our method, pure perl scripts can still take advantage of the full power of Storable, AND we didn't have to have a hacked version of Apache::Session::MySQL in order to get it to work. I fail to see how your method is any easier ours...


In reply to Re: Re: Re: Using Sessions between perl and php. by jryan
in thread Using Sessions between perl and php. by jryan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.