FAQ
Hi!

Is it correct, that it is impossible to store blessed references (Perl
objects) in udat? Same for mdat?

If yes, is there any workaround? Maybe serializing the object first
with Storable or something like this? But if i interpreted the mails
in the archive correct this still will not work with DBI-Connections?

Is there a way to use only one DBI-Connection for the whole
application?

Benni
--
http://www.aymargeddon.de


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org

Search Discussions

  • Luiz Fernando B. Ribeiro at Dec 2, 2003 at 10:52 am

    On Tue, 2 Dec 2003 10:36:32 +0100, Benni Baermann wrote:

    Hi!

    Is it correct, that it is impossible to store blessed references (Perl
    objects) in udat? Same for mdat?

    If yes, is there any workaround? Maybe serializing the object first
    with Storable or something like this? But if i interpreted the mails
    in the archive correct this still will not work with DBI-Connections?

    Is there a way to use only one DBI-Connection for the whole
    application?
    I'll give you some suggestions and maybe others may complement it.

    I think tha what you mean with "only one DBI-Connection for the whole
    application" is in fact one DBI connection for each Apache child.

    There are some ways to do these but the most common is to use Apache::DBI.
    It will do the caching for you. So write a page (component) that starts
    the connection and put it back in the $req_rec reference so it will be
    available to all other Executed pages in the same request.
    Example:

    connect.epr:
    [-
    $req = shift;
    $req->{dbh} = new DBI(...);
    -]


    In your pages:
    [-
    Execute('connect.epr');

    $req = shift;
    $dbh = $req->{dbh};

    # Database stuff...
    -]

    In other Executed parts:
    [-
    $req = shift;
    $dbh = $req->{dbh};

    # More database stuff
    -]

    This is a simple method and of course there are more elegant approaches
    you could try.

    About storing objects in udat I usually avoid it, its better to store
    simple variables.
    If you need objects you have to make shure the serialized data are not
    bigger than the capacity of the column in your database (usually 32k).

    Good luck,

    --
    Luiz Fernando B. Ribeiro
    Engenho Soluções para a Internet

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Dec 2, 2003 at 3:25 pm
    Hi,
    Is it correct, that it is impossible to store blessed references (Perl
    objects) in udat? Same for mdat?
    You can store blessed references and objects.
    If yes, is there any workaround? Maybe serializing the object first
    with Storable or something like this? But if i interpreted the mails
    in the archive correct this still will not work with DBI-Connections?
    You can't store a DBI handle (or file handle). How do you want to store a
    handle in a database or flat file, that might be picked up by a different
    process...
    Is there a way to use only one DBI-Connection for the whole
    application?
    Take a look at Apache::DBI

    Gerald

    Benni
    --------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylösungen * dynamische Webapplikationen * Consulting

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    --------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    +-------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupembperl @
categoriesmodperl, perl
postedDec 2, '03 at 9:40a
activeDec 2, '03 at 3:25p
posts3
users3
websiteperl.apache.org

People

Translate

site design / logo © 2022 Grokbase