Skip Menu |

This queue is for tickets about the Class-Null CPAN distribution.

Report information
The Basics
Id: 3981
Status: resolved
Priority: 0/
Queue: Class-Null

People
Owner: Nobody in particular
Requestors: ben_tilly [...] operamail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.02
Fixed in: (no value)



Subject: Fails test, and documentation unclear
I am running Debian Linux with Perl 5.8.0. make test fails, see the output at the end. An additional issue is that your documentation does not make it clear whether your module is usable in chained method calls. It is not, and that fact should be documented. (OTOH had I known that fact then I would not have tried downloading it to find out, which would mean that nobody would have submitted the above bug report...) If you want advice on how to make it able to handle chained method calls, the autoload should always return null objects, and then you can use an [overload] to return strings and numbers correctly, and issue appropriate warnings. You need to issue warnings yourself, returning an undef in an overload will work under 5.8, but segfaults 5.6. Here is the output from the failed test. localhost:~/.cpan/build/Class-Null-1.02# make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01distribution....NOK 2# Failed test (/usr/local/share/perl/5.8.0/Test/Distribution.pm at line 170) t/01distribution....ok 8/8# Looks like you failed 1 tests of 8. t/01distribution....dubious Test returned status 1 (wstat 256, 0x100) Constant subroutine __need_size_t redefined at /usr/lib/perl/5.8.0/stddef.ph line 146. DIED. FAILED test 2 Failed 1/8 tests, 87.50% okay t/02null............ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/01distribution.t 1 256 8 1 12.50% 2 Failed 1/2 test scripts, 50.00% okay. 1/40 subtests failed, 97.50% okay. make: *** [test_dynamic] Error 29
Hi, (just noticed that it's been precisely two years since you reported that bug - wow, that's service worthy of Microsoft...) The bug should be fixed now, and Class::Null has method chaining now. But I'm not sure what you mean by [guest - Sat Oct 4 13:36:23 2003]: Show quoted text
> [...] then you > can use an [overload] to return strings and numbers correctly, and > issue appropriate warnings. You need to issue warnings yourself, > returning an undef in an overload will work under 5.8, but > segfaults 5.6.
Why is an overload necessary; how do strings and numbers come into null objects? (Sorry if I'm a bit dense here...) Thanks for reporting, Marcel
[...] Show quoted text
> > [...] then you > > can use an [overload] to return strings and numbers correctly, and > > issue appropriate warnings. You need to issue warnings yourself, > > returning an undef in an overload will work under 5.8, but > > segfaults 5.6.
> > Why is an overload necessary; how do strings and numbers come into > null objects? (Sorry if > I'm a bit dense here...)
Consider the following code sample: if (($obj->method || $NULL)->some_test) { # do something } This pattern works much more conveniently if your null object is false in boolean context. That piece requires overload. Once you're looking at overload anyways, what should be printed if someone tries to print a null object, and what should be added if you try to add it? Reasonable defaults to me are "" and 0 respectively. Cheers, Ben
Ok, that's how it works now.