… | |
… | |
318 | if (len == 1) |
318 | if (len == 1) |
319 | if (*pv == '1') |
319 | if (*pv == '1') |
320 | return 1; |
320 | return 1; |
321 | else if (*pv == '0') |
321 | else if (*pv == '0') |
322 | return 0; |
322 | return 0; |
323 | |
|
|
324 | } |
323 | } |
325 | |
324 | |
326 | return -1; |
325 | return -1; |
327 | } |
326 | } |
328 | |
327 | |
… | |
… | |
333 | if (!SvROK (scalar)) |
332 | if (!SvROK (scalar)) |
334 | return 1; |
333 | return 1; |
335 | |
334 | |
336 | scalar = SvRV (scalar); |
335 | scalar = SvRV (scalar); |
337 | |
336 | |
|
|
337 | if (SvTYPE (scalar) >= SVt_PVMG) |
|
|
338 | { |
338 | if (SvSTASH (scalar) == bool_stash) |
339 | if (SvSTASH (scalar) == bool_stash) |
339 | return 1; |
340 | return 1; |
340 | |
341 | |
341 | if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0) |
342 | if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0) |
342 | return 1; |
343 | return 1; |
|
|
344 | } |
343 | |
345 | |
344 | return 0; |
346 | return 0; |
345 | } |
347 | } |
346 | |
348 | |
347 | ///////////////////////////////////////////////////////////////////////////// |
349 | ///////////////////////////////////////////////////////////////////////////// |
… | |
… | |
1696 | |
1698 | |
1697 | /* work around bugs in 5.10 where manipulating magic values |
1699 | /* work around bugs in 5.10 where manipulating magic values |
1698 | * makes perl ignore the magic in subsequent accesses. |
1700 | * makes perl ignore the magic in subsequent accesses. |
1699 | * also make a copy of non-PV values, to get them into a clean |
1701 | * also make a copy of non-PV values, to get them into a clean |
1700 | * state (SvPV should do that, but it's buggy, see below). |
1702 | * state (SvPV should do that, but it's buggy, see below). |
|
|
1703 | * |
|
|
1704 | * SvIsCOW_shared_hash works around a bug in perl (possibly 5.16), |
|
|
1705 | * as reported by Reini Urban. |
1701 | */ |
1706 | */ |
1702 | /*SvGETMAGIC (string);*/ |
1707 | /*SvGETMAGIC (string);*/ |
1703 | if (SvMAGICAL (string) || !SvPOK (string)) |
1708 | if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string)) |
1704 | string = sv_2mortal (newSVsv (string)); |
1709 | string = sv_2mortal (newSVsv (string)); |
1705 | |
1710 | |
1706 | SvUPGRADE (string, SVt_PV); |
1711 | SvUPGRADE (string, SVt_PV); |
1707 | |
1712 | |
1708 | /* work around a bug in perl 5.10, which causes SvCUR to fail an |
1713 | /* work around a bug in perl 5.10, which causes SvCUR to fail an |