Skip Menu |
 

This queue is for tickets about the Scalar-Defer CPAN distribution.

Report information
The Basics
Id: 73677
Status: open
Priority: 0/
Queue: Scalar-Defer

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.23
Fixed in: (no value)



Subject: Dealing with undefined values
Download (untitled) / with headers
text/plain 382b
It seems that it's not possible to store an undefined value in a lazy variable. Both test cases in the following script fail (but it works if my $undefined=undef is used instead): #!/usr/bin/perl use strict; use warnings; use Scalar::Defer 'lazy'; use Test::More 'no_plan'; my $undefined = lazy { undef }; ok !defined $undefined; is $undefined, undef; __END__ Regards, Slaven
Download (untitled) / with headers
text/plain 695b
On Mon Jan 02 12:19:28 2012, SREZIC wrote: Show quoted text
> It seems that it's not possible to store an undefined value in a lazy > variable. Both test cases in the following script fail (but it works if > my $undefined=undef is used instead): > > #!/usr/bin/perl > use strict; > use warnings; > use Scalar::Defer 'lazy'; > use Test::More 'no_plan'; > my $undefined = lazy { undef }; > ok !defined $undefined; > is $undefined, undef; > __END__
It’s not possible to override definedness, except perhaps by overriding CORE::GLOBAL::defined. If Scalar::Defer were to use ties, it might be possible to make this work, but the interface would have to change. Maybe something like lazy { undef } $undefined;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.