Skip Menu |

This queue is for tickets about the IO-Lambda CPAN distribution.

Report information
The Basics
Id: 59435
Status: resolved
Priority: 0/
Queue: IO-Lambda

People
Owner: Nobody in particular
Requestors: njh [...] bandsman.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.20
Fixed in: (no value)



Subject: Doesn't work with require
The attached program works fine if I use "use", but with "require" I get compilation errors.
Subject: lambda4
Download lambda4
application/octet-stream 689b

Message body not shown because it is not plain text.

That's because the compiler can't decide whether a function called as "lambda {}" is being called with a sub or a hash, and decides the latter. Use explicit "lambda(sub {})" instead. See also an interesting related example at "perldoc perlref" near hashem/showem keywords.
Subject: Re: [rt.cpan.org #59435] Doesn't work with require
Date: Sat, 17 Jul 2010 16:26:30 +0100
To: bug-IO-Lambda [...] rt.cpan.org
From: Nigel Horne <njh [...] bandsman.co.uk>
On 17/07/10 12:33, KARASIK via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=59435> > > That's because the compiler can't decide whether a function called as > "lambda {}" is being called with a sub or a hash, and decides the > latter. Use explicit "lambda(sub {})" instead. See also an interesting > related example at "perldoc perlref" near hashem/showem keywords. >
That makes sense. Essentially, I took the example from your man page - it would help if your man page didn't have this usage and used the "sub" method instead. -Nigel
Ah, but the man page has "use IO::Lambda" instead of "require" where it shows the package syntax, and this problem is only manifested with "require". But generally yes, I agree.