Skip Menu |

This queue is for tickets about the Try-Tiny CPAN distribution.

Report information
The Basics
Id: 113622
Status: rejected
Priority: 0/
Queue: Try-Tiny

People
Owner: Nobody in particular
Requestors: boftx [...] hotmail.com
Cc:
AdminCc:

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



Subject: Try::Tiny does not receive @_ when used with Role::Tiny
Date: Fri, 8 Apr 2016 13:13:11 -0700
To: bug-Try-Tiny [...] rt.cpan.org
From: Jim Bacon <boftx [...] hotmail.com>
Hi, I’m not sure if this is a bug or not, and if so, is it from Try::Tiny or Role::Tiny. The two test scripts included here demonstrate the interaction. The first one presents the scenario that led to the discover of this. The second demonstrates that it appears to be the interaction of the two modules. The scripts present the problem must better than I can describe it. Thank you for your time. Test environments: 1. Perl 5.16, Try::Tiny 0.19, Role::Tiny 2.000001 2. Perl 5.8.8 Try::Tiny 0.22, Role::Tiny 2.000001 Jim Bacon (boftx)
Subject: Try::Tiny does not receive @_ when used with Role::Tiny
Date: Fri, 8 Apr 2016 13:17:11 -0700
To: bug-Try-Tiny [...] rt.cpan.org
From: Jim Bacon <boftx [...] hotmail.com>
Hi, I’m not sure if this is a bug or not, and if so, is it from Try::Tiny or Role::Tiny. The two test scripts included here demonstrate the interaction. The first one presents the scenario that led to the discover of this. The second demonstrates that it appears to be the interaction of the two modules. The scripts present the problem must better than I can describe it. Thank you for your time. Test environments: 1. Perl 5.16, Try::Tiny 0.19, Role::Tiny 2.000001 2. Perl 5.8.8 Try::Tiny 0.22, Role::Tiny 2.000001 Jim Bacon (boftx)

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

On 2016-04-08 13:17:28, boftx@hotmail.com wrote: Show quoted text
> Hi, > > I’m not sure if this is a bug or not, and if so, is it from Try::Tiny > or Role::Tiny. The two test scripts included here demonstrate the > interaction. The first one presents the scenario that led to the > discover of this. The second demonstrates that it appears to be the > interaction of the two modules.
The block you pass to Try::Tiny::try is actually a subroutine -- so its view of @_ will not be the same as that of the subroutine that called try. I don't think this is a bug -- you just need to capture @_ into a named variable before calling try.
Subject: Re: [rt.cpan.org #113623] Try::Tiny does not receive @_ when used with Role::Tiny
Date: Fri, 8 Apr 2016 13:43:58 -0700
To: bug-Try-Tiny [...] rt.cpan.org
From: Jim Bacon <boftx [...] hotmail.com>
Show quoted text
> On Apr 8, 2016, at 1:37 PM, Karen Etheridge via RT <bug-Try-Tiny@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=113623 > > > On 2016-04-08 13:17:28, boftx@hotmail.com wrote:
>> Hi, >> >> I’m not sure if this is a bug or not, and if so, is it from Try::Tiny >> or Role::Tiny. The two test scripts included here demonstrate the >> interaction. The first one presents the scenario that led to the >> discover of this. The second demonstrates that it appears to be the >> interaction of the two modules.
> > The block you pass to Try::Tiny::try is actually a subroutine -- so its view of @_ will not be the same as that of the subroutine that called try. I don't think this is a bug -- you just need to capture @_ into a named variable before calling try.
I would be inclined to agree, but the 2nd file shows that @_ is present as expected when used in a “normal” method, i.e. not in combination with “around”. That is why I am confused as just where this should be reported to or inquired about. It is simple enough t work around by capturing but as always that means competent code review and tests. :) Jim
On 2016-04-08 13:44:11, boftx@hotmail.com wrote: Show quoted text
> I would be inclined to agree, but the 2nd file shows that @_ is > present as expected when used in a “normal” method, i.e. not in > combination with “around”. That is why I am confused as just where > this should be reported to or inquired about.
The second file's "good test" is testing with @args, as captured from @_. I don't see any passing tests that check @_ itself.
Subject: Re: [rt.cpan.org #113622] Try::Tiny does not receive @_ when used with Role::Tiny
Date: Fri, 8 Apr 2016 14:12:27 -0700
To: bug-Try-Tiny [...] rt.cpan.org
From: Jim Bacon <boftx [...] hotmail.com>
Show quoted text
> On Apr 8, 2016, at 2:07 PM, Karen Etheridge via RT <bug-Try-Tiny@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=113622 > > > On 2016-04-08 13:44:11, boftx@hotmail.com wrote: >
>> I would be inclined to agree, but the 2nd file shows that @_ is >> present as expected when used in a “normal” method, i.e. not in >> combination with “around”. That is why I am confused as just where >> this should be reported to or inquired about.
> > The second file's "good test" is testing with @args, as captured from @_. > I don't see any passing tests that check @_ itself.
In trytiny_incoming2.t, the test named bad_test (misleading name this time) is passing with @_ inside the try block. Jim JGBMacintosh:stuff jimbacon$ prove -v trytiny_incoming2.t trytiny_incoming2.t .. ok 1 - @_ is present inside called method ok 2 - @_ is present inside try ok 3 - bad_test received correct number of params ok 4 - @args is present inside called method ok 5 - @args is present inside try ok 6 - good_test received correct number of params 1..6 ok All tests successful. Files=1, Tests=6, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.06 CPU) Result: PASS
In trytiny_incoming2.t, you aren't importing Try::Tiny. So you are suffering from indirect object syntax, and the sub is being run directly as part of the 'bat_test' sub and not trapping errors at all. There is no bug here, and the caveat of @_ not being available inside try is documented.
not a bug; closing.