Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^4: Never use Storable to save XS objects

by robins (Acolyte)
on Nov 08, 2007 at 18:00 UTC ( [id://649774]=note: print w/replies, xml ) Need Help??

in reply to Re^3: Never use Storable to save XS objects
in thread Never use Storable to save XS objects

Well, basically, I don't want to store the database connection at all.

When I store I want the database connection to be ignored (or filtered out), and when I thaw I want the object to use the currently open connection in the application.

I need to store Perl objects, and for some reason I end up with code references in what I'm storing, and my debugging have shown that it is DBI handles.

If you know of a good and generic way to create a Perl object that uses DBI handles for some of it's method, but allow the object itself to be stored via Storable I'm more than open to some pointers to good documentation. There is a good chance that my constructor is designed in a way that I end up with code references that I do not need.

  • Comment on Re^4: Never use Storable to save XS objects

Replies are listed 'Best First'.
Re^5: Never use Storable to save XS objects
by dragonchild (Archbishop) on Nov 08, 2007 at 18:36 UTC
    If you already have a $dbh open in your app, then pass it in to all the methods instead of passing it into the object's constructor. Why should the object know about the $dbh if you don't ever want to serialize it?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://649774]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-07-22 10:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.