On Fri, Sep 26, 2003 at 12:45:10PM -0400, Rudy Lippan wrote:
> On Wed, 24 Sep 2003, Tim Bunce wrote:
> > On Tue, Sep 23, 2003 at 08:39:34PM +0100, Tony Bowden wrote:
> 
> > > As discovered from talking to Dominic off list, it seems that DBD::Pg
> > > doesn't like being given overloaded objects as placeholder values:
> > 
> > That's a bug in the driver. May affect other drivers so I've cc'd
> > this to [EMAIL PROTECTED]
> 
> DBD::Pg checks that what you are binding is not a reference and does not 
> let you bind it -- I assume so you don't accidently bind a reference 
> variable.  The problem is that an object with an overloaded stringify 
> looks like a reference.  Commenting out the check lets the SV fall 
> through to the SvPV and everthing works as it should.
> 
> I can't seem to think of a way to keep this check and get the overloaded
> stringify to work... This is probably due to my lack of understaing of how
> overload works.  I am assuming that there is magic on the variable and I
> could do a mg_get if it is Magical, and then if SvPOK skip the refrence
> check, but that does not seem to work?

I think this would be okay:

    if (SvROK(sv) && !SvAMAGIC(sv) {
        ...error...
    }
    string = SvPV(sv, len);

any reference that has overload magic should be expected to be able
to stringify itself to something reasonable (or else the caller can
call some method on it and bind the result of that instead).

Tim.

Reply via email to