NAME

Test::MockPackages::Returns - provides a helper subroutine for creating custom returns

VERSION

Version 1.00

SYNOPSIS

use Test::MockPackages::Returns qw(returns_code);
...
$m->expects( $arg1, $arg2 )
  ->returns( returns_code {
      my (@args) = @ARG;

       return join ', ', @args;
  } );

DESCRIPTION

This package contains the returns_code subroutine which provides the capability to have a CODE executed to return a custom value in a returns expectation.

SUBROUTINES

returns_code(&)( CodeRef $coderef ) : Test::MockPackages::Returns

Returns a new Test::MockPackages::Returns object. Under the hood, it's really just the same CodeRef which has been blessed into this package.

This subroutine is exported using @EXPORT_OK.

Return value: a blessed CodeRef.

AUTHOR

Written by Tom Peters <tpeters at synacor.com>.

COPYRIGHT

Copyright (c) 2016 Synacor, Inc.