Re: Gtk::TreeStore insert_with_values weirdness
- From: muppet <scott asofyet org>
- To: "Jens Luedicke" <jens luedicke gmail com>
- Cc: Gtk2-Perl List <gtk-perl-list gnome org>
- Subject: Re: Gtk::TreeStore insert_with_values weirdness
- Date: Thu, 4 Jan 2007 13:53:48 -0500
On Jan 4, 2007, at 10:53 AM, Jens Luedicke wrote:
On 1/3/07, Roderich Schupp <roderich schupp googlemail com> wrote:
Are you using the XS variant of Readonly (i.e. have Readonly::XS
installed)
or the pure-perl variant? The latter implements readonly scalars
as tied scalars
(with a STORE method that just croaks)... My guess is that the XS
glue in
Gtk::TreeStore (at least) doesn't cope with tied scalars (you need
extra
code to handle tied scalars from XS).
Same problem with Readonly::XS.
Another thing I noticed: Only $COL_FILEINFO (== 0) is affected. I can
use the other two Readonly scalars just fine.
Perhaps the get magic is returning undef or empty string when the
value is zero?
Does it work fine when you don't use Readonly here?
The code in insert_with_values() attempts to do some extra sanity
checking on the input to give meaningful and helpful error messages
to the hapless programmer who may be guessing at the API. The logic is
for each column/value pair on the stack
get the column id scalar
if the column id scalar doesn't look like a number
croak
get the column id by coercing the scalar to an integer
put the value scalar into a GValue
We did that because if you don't, then any failed conversion of a non-
number to a number give you zero --- silently using column 0 for
everything that you wrote incorrectly. Mystifying -> Frustrating ->
Infuriating.
Now, perl's looks_like_number() function is implemented like this:
if the "i'm a string" flag is on
get the string with SvPVX()
else if i can be coerced into a string
get the string with SvPV()
else
return true if any of the "number ok" or "integer ok"
flags are on
return the result of the function that parses a number
It would be interesting to know which of those tests is failing
here. Are we failing on bad handling of get magic? Does the
Readonly variable refuse to be coerced into a string?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]