Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

What is your opinion of DBIx::Connector? Do you think you should delegate the complexity of keeping database connections alive to it?

It solves a different, unrelated problem. I'm not inclined to let DBIx::Simple depend on anything but DBI, except optionally.

Also, please note well that destruction bugs and disconnection bugs are two separate classes of problem. I dont know which the use of double quotes about $db was supposed to address.

I'm aware. Avoiding circular references has to do with avoiding problems regarding destruction; in particular, avoiding that destruction never happens during runtime. Because in DBIx::Simple, destruction causes disconnection (iff you let DBIx::Simple create the connection), I mentioned them together.

But I do know that common sense about reference counting between a DBIx::Simple database handle and DBIx::Simple::Statement which has-a database handle should not require any particular weakening like you are doing.

Common sense dictates that one does not use a circular reference if one can easily do without. There's no reason for ::Statement to have-a database handle, so it doesn't has-a one at all. All it needs is to refer to the object, as a hash key. That's a string. So all we need is that string. Et voila, we've avoided circular references without the complexity and risks of weakening. You're referring to the trick I'm using as "weakening" but it is very different.

I simply dont understand why we need to prevent the reference count from naturally increasing and decreasing as the DBIx::Simple instance becomes a compononent of DBIx::Simple::Statement instances.

tye has explained this thoroughly, with examples of what happens. I'm sorry, but if you don't understand his explanation, you don't understand destruction and you should really never use, or suggest that anyone use, a circular reference.

But I would say this. Local::DBIx::Simple is a very simple, clearly written wrapper and it isnt working.

It is working. I believe that the problem you encounter lies somewhere within the libraries you're using for object management, or, possibly, perl itself.

In any case, the workaround is extremely simple and clear and you've already discovered it yourself: use a variable.


In reply to Re^11: method chaining fails where separate method calls succeed in DBIx::Simple (lifecycle) by Juerd
in thread method chaining fails where separate method calls succeed in DBIx::Simple by Anonymous Monk

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2014-07-12 06:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (238 votes), past polls