Skip Menu |
 

This queue is for tickets about the Error-Return CPAN distribution.

Report information
The Basics
Id: 43402
Status: new
Priority: 0/
Queue: Error-Return

People
Owner: Nobody in particular
Requestors: d.raab [...] angel.de
Cc:
AdminCc:

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



Subject: context
Date: Wed, 18 Feb 2009 18:40:50 +0100
To: bug-Error-Return [...] rt.cpan.org
From: David Raab <d.raab [...] angel.de>
Download (untitled) / with headers
text/plain 800b
Error::Return does not use the return context from is "upper" function. Show quoted text
> use Error qw(:try); > use Error::Return; > > print my_localtime(), "\n"; > print scalar(my_localtime()), "\n"; > > print "\n"; > > print my_localtime2(), "\n"; > print scalar(my_localtime2()), "\n"; > > sub my_localtime { > print wantarray() ? 'array' : 'scalar', ': '; > return localtime(); > } > > sub my_localtime2 { > try { > print wantarray() ? 'array' : 'scalar', ': '; > RETURN localtime(); > }; > }
If you have something like this then in my_localtime2 the context is still a list context but it returns only the first element. Output of the above script can something like this: Show quoted text
> array: 640181811093480 > scalar: Wed Feb 18 18:40:06 2009 > > array: 640181811093480 > scalar: 6


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.