Skip Menu |

This queue is for tickets about the MooX-Cmd CPAN distribution.

Report information
The Basics
Id: 91500
Status: resolved
Priority: 0/
Queue: MooX-Cmd

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

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



Subject: MooX::Cmd::Tester: incorrect execute_return if execute_from_new => undef
If execute_from_new is undef, the execute_rv value returned from test_cmd's returned object isn't correct. Here's the test code: ------------------------------------------ package MyApp; use Moo; use MooX::Cmd; sub execute { __PACKAGE__ }; package MyAppNoExec; use Moo; use MooX::Cmd execute_from_new => undef; sub execute { __PACKAGE__ }; package main; use Test::More; use Moo; use MooX::Cmd::Tester; use Data::Dumper; print Dumper test_cmd( 'MyApp', [] )->execute_rv; print Dumper test_cmd( 'MyAppNoExec', [] )->execute_rv; done_testing; ------------------------------------------ And here are the results: ------------------------------------------ % perl test.pl ok 1 - got a 'MyApp' from new_with_cmd ok 2 - $\#argv vs. command chain length testing MyApp => [ ] $VAR1 = [ 'MyApp' ]; ok 3 - got a 'MyAppNoExec' from new_with_cmd ok 4 - $\#argv vs. command chain length testing MyAppNoExec => [ ] $VAR1 = []; 1..4 ------------------------------------------ The problem seems to be in MooX::Cmd::Tester::_run_with_capture 97 $cmd->command_execute_from_new 98 or $cmd->can( $cmd->command_execute_method_name )->($cmd); 99 my @execute_return = @{ $cmd->can($cmd->command_execute_return_method_name)->($cmd) }; $cmd->can( $cmd->command_execute_method_name) returns MyApp::execute directly, so there's no wrapper to catch the return value and thus populate the execute_return slot in $cmd
I pushed a fix to GitHub (98feae23ad) - please give it a shot.
On Sat Feb 01 16:09:55 2014, REHSACK wrote: Show quoted text
> I pushed a fix to GitHub (98feae23ad) - please give it a shot.
My apologies for the long delay in replying. It passes my simple tests. It may some time before I can dig back into the application and see if it works in production.
Seems to be resolved
On Fri Mar 06 09:08:27 2015, REHSACK wrote: Show quoted text
> Seems to be resolved
Thanks!