<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.18
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: blib/lib/Test/Mocha/Util.pm</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">blib/lib/Test/Mocha/Util.pm</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c3">100.0%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">package Test::Mocha::Util;</td></tr>
<tr><td class="h">2</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># ABSTRACT: Internal utility functions</td></tr>
<tr><td class="h">3</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">$Test::Mocha::Util::VERSION = &#39;0.61&#39;;</td></tr>
<tr><td class="h">4</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L4">12</a></div></td><td></td><td><div>35</div><div>12</div><div>266</div></td><td class="s">use strict;</td></tr>
<tr><td class="h">5</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L5">12</a></div></td><td></td><td><div>29</div><div>13</div><div>199</div></td><td class="s">use warnings;</td></tr>
<tr><td class="h">6</td><td colspan="7"></td></tr><tr><td class="h">7</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L7">12</a></div></td><td></td><td><div>29</div><div>9</div><div>418</div></td><td class="s">use Carp &#39;croak&#39;;</td></tr>
<tr><td class="h">8</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L8">12</a></div></td><td></td><td><div>34</div><div>7</div><div>178</div></td><td class="s">use Exporter &#39;import&#39;;</td></tr>
<tr><td class="h">9</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L9">12</a></div></td><td></td><td><div>29</div><div>10</div><div>39</div></td><td class="s">use Test::Mocha::Types &#39;Slurpy&#39;;</td></tr>
<tr><td class="h">10</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L10">12</a></div></td><td></td><td><div>3820</div><div>3185</div><div>442</div></td><td class="s">use Try::Tiny;</td></tr>
<tr><td class="h">11</td><td><div class="c3">12</div><div class="c3">12</div><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L11">12</a></div></td><td></td><td><div>37</div><div>12</div><div>40</div></td><td class="s">use Types::Standard qw( ArrayRef HashRef );</td></tr>
<tr><td class="h">12</td><td colspan="7"></td></tr><tr><td class="h">13</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">our @EXPORT_OK = qw(</td></tr>
<tr><td class="h">14</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;check_slurpy_arg</td></tr>
<tr><td class="h">15</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;extract_method_name</td></tr>
<tr><td class="h">16</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;find_caller</td></tr>
<tr><td class="h">17</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;find_stub</td></tr>
<tr><td class="h">18</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;get_method_call</td></tr>
<tr><td class="h">19</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">);</td></tr>
<tr><td class="h">20</td><td colspan="7"></td></tr><tr><td class="h">21</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub check_slurpy_arg {</td></tr>
<tr><td class="h">22</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">23</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# Checks the arguments list for the presence of a slurpy argument matcher.</td></tr>
<tr><td class="h">24</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# It will throw an error if it is used incorrectly.</td></tr>
<tr><td class="h">25</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# Otherwise it will just return silently.</td></tr>
<tr><td class="h">26</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">27</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">28</td><td><div class="c3">580</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L28">580</a></div></td><td><div class="c3">0</div></td><td><div>383</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my @args = @_;</td></tr>
<tr><td class="h">29</td><td colspan="7"></td></tr><tr><td class="h">30</td><td><div class="c3">580</div></td><td></td><td></td><td></td><td></td><td><div>321</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my $i = 0;</td></tr>
<tr><td class="h">31</td><td><div class="c3">580</div></td><td></td><td></td><td></td><td></td><td><div>463</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;foreach (@args) {</td></tr>
<tr><td class="h">32</td><td><div class="c3">564</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L32">100</a></div></td><td></td><td></td><td></td><td><div>555</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( Slurpy-&gt;check($_) ) {</td></tr>
<tr><td class="h">33</td><td><div class="c3">72</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L33">100</a></div></td><td></td><td></td><td></td><td><div>1135</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;croak &#39;No arguments allowed after a slurpy type constraint&#39;</td></tr>
<tr><td class="h">34</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if $i &lt; $#args;</td></tr>
<tr><td class="h">35</td><td colspan="7"></td></tr><tr><td class="h">36</td><td><div class="c3">68</div></td><td></td><td></td><td></td><td></td><td><div>48</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my $slurpy = $_-&gt;{slurpy};</td></tr>
<tr><td class="h">37</td><td><div class="c3">68</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L37">100</a></div></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--condition.html#L37">100</a></div></td><td></td><td></td><td><div>71</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;croak &#39;Slurpy argument must be a type of ArrayRef or HashRef&#39;</td></tr>
<tr><td class="h">38</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unless $slurpy-&gt;is_a_type_of(ArrayRef)</td></tr>
<tr><td class="h">39</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|| $slurpy-&gt;is_a_type_of(HashRef);</td></tr>
<tr><td class="h">40</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">41</td><td><div class="c3">557</div></td><td></td><td></td><td></td><td></td><td><div>16568</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$i++;</td></tr>
<tr><td class="h">42</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">43</td><td><div class="c3">573</div></td><td></td><td></td><td></td><td></td><td><div>584</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return;</td></tr>
<tr><td class="h">44</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">45</td><td colspan="7"></td></tr><tr><td class="h">46</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub extract_method_name {</td></tr>
<tr><td class="h">47</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;Extracts the method name from its fully qualified name.&quot;&quot;&quot;</td></tr>
<tr><td class="h">48</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">49</td><td><div class="c3">282</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L49">282</a></div></td><td><div class="c3">0</div></td><td><div>210</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my ($method_name) = @_;</td></tr>
<tr><td class="h">50</td><td><div class="c3">282</div></td><td></td><td></td><td></td><td></td><td><div>585</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;$method_name =~ s/.*:://sm;</td></tr>
<tr><td class="h">51</td><td><div class="c3">282</div></td><td></td><td></td><td></td><td></td><td><div>363</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return $method_name;</td></tr>
<tr><td class="h">52</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">53</td><td colspan="7"></td></tr><tr><td class="h">54</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub find_caller {</td></tr>
<tr><td class="h">55</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;Search the call stack to find an external caller&quot;&quot;&quot;</td></tr>
<tr><td class="h">56</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">57</td><td><div class="c3">266</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L57">266</a></div></td><td><div class="c3">0</div></td><td><div>159</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my ( $package, $file, $line );</td></tr>
<tr><td class="h">58</td><td colspan="7"></td></tr><tr><td class="h">59</td><td><div class="c3">266</div></td><td></td><td></td><td></td><td></td><td><div>141</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my $i = 1;</td></tr>
<tr><td class="h">60</td><td><div class="c3">266</div></td><td></td><td></td><td></td><td></td><td><div>154</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;while () {</td></tr>
<tr><td class="h">61</td><td><div class="c3">267</div></td><td></td><td></td><td></td><td></td><td><div>861</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;( $package, $file, $line ) = caller $i++;</td></tr>
<tr><td class="h">62</td><td><div class="c3">267</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L62">100</a></div></td><td></td><td></td><td></td><td><div>553</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last if $package ne &#39;UNIVERSAL::ref&#39;;</td></tr>
<tr><td class="h">63</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">64</td><td><div class="c3">266</div></td><td></td><td></td><td></td><td></td><td><div>626</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return ( $file, $line );</td></tr>
<tr><td class="h">65</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">66</td><td colspan="7"></td></tr><tr><td class="h">67</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub find_stub {</td></tr>
<tr><td class="h">68</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">69</td><td><div class="c3">268</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L69">268</a></div></td><td><div class="c3">0</div></td><td><div>158</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my ( $mock, $method_call ) = @_;</td></tr>
<tr><td class="h">70</td><td colspan="7"></td></tr><tr><td class="h">71</td><td><div class="c3">268</div></td><td></td><td></td><td></td><td></td><td><div>295</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my $stubs = $mock-&gt;__stubs;</td></tr>
<tr><td class="h">72</td><td><div class="c3">268</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L72">100</a></div></td><td></td><td></td><td></td><td><div>334</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return if !defined $stubs-&gt;{ $method_call-&gt;name };</td></tr>
<tr><td class="h">73</td><td colspan="7"></td></tr><tr><td class="h">74</td><td><div class="c3">99</div><div class="c3">99</div></td><td></td><td></td><td></td><td></td><td><div>60</div><div>113</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;foreach my $stub ( @{ $stubs-&gt;{ $method_call-&gt;name } } ) {</td></tr>
<tr><td class="h">75</td><td><div class="c3">128</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L75">100</a></div></td><td></td><td></td><td></td><td><div>171</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $stub if $stub-&gt;satisfied_by($method_call);</td></tr>
<tr><td class="h">76</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">77</td><td><div class="c3">17</div></td><td></td><td></td><td></td><td></td><td><div>28</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return;</td></tr>
<tr><td class="h">78</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">79</td><td colspan="7"></td></tr><tr><td class="h">80</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub get_method_call {</td></tr>
<tr><td class="h">81</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">82</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# Get the last method called on a mock object,</td></tr>
<tr><td class="h">83</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# removes it from the invocation history,</td></tr>
<tr><td class="h">84</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# and restores the last method stub response.</td></tr>
<tr><td class="h">85</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">86</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">87</td><td><div class="c3">139</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L87">139</a></div></td><td><div class="c3">0</div></td><td><div>103</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my ($coderef) = @_;</td></tr>
<tr><td class="h">88</td><td colspan="7"></td></tr><tr><td class="h">89</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;try {</td></tr>
<tr><td class="h">90</td><td><div class="c3">139</div></td><td></td><td></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L90">139</a></div></td><td></td><td><div>2919</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$coderef-&gt;();</td></tr>
<tr><td class="h">91</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">92</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;catch {</td></tr>
<tr><td class="h">93</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## no critic (RequireCarping,RequireExtendedFormatting)</td></tr>
<tr><td class="h">94</td><td><div class="c3">9</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L94">100</a></div></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--condition.html#L94">100</a></div></td><td><div class="c3"><a href="blib-lib-Test-Mocha-Util-pm--subroutine.html#L94">9</a></div></td><td></td><td><div>153</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die $_</td></tr>
<tr><td class="h">95</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( m{^No arguments allowed after a slurpy type constraint}sm</td></tr>
<tr><td class="h">96</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|| m{^Slurpy argument must be a type of ArrayRef or HashRef}sm );</td></tr>
<tr><td class="h">97</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## use critic</td></tr>
<tr><td class="h">98</td><td><div class="c3">139</div></td><td></td><td></td><td></td><td></td><td><div>423</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;};</td></tr>
<tr><td class="h">99</td><td colspan="7"></td></tr><tr><td class="h">100</td><td><div class="c3">132</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L100">100</a></div></td><td></td><td></td><td></td><td><div>1326</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;croak &#39;Coderef must have a method invoked on a mock object&#39;</td></tr>
<tr><td class="h">101</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if $Test::Mocha::Mock::num_method_calls == 0;</td></tr>
<tr><td class="h">102</td><td><div class="c3">130</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L102">100</a></div></td><td></td><td></td><td></td><td><div>224</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;croak &#39;Coderef must not have multiple methods invoked on a mock object&#39;</td></tr>
<tr><td class="h">103</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if $Test::Mocha::Mock::num_method_calls &gt; 1;</td></tr>
<tr><td class="h">104</td><td colspan="7"></td></tr><tr><td class="h">105</td><td><div class="c3">129</div></td><td></td><td></td><td></td><td></td><td><div>83</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my $method_call = $Test::Mocha::Mock::last_method_call;</td></tr>
<tr><td class="h">106</td><td><div class="c3">129</div></td><td></td><td></td><td></td><td></td><td><div>159</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;my $mock&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= $method_call-&gt;invocant;</td></tr>
<tr><td class="h">107</td><td colspan="7"></td></tr><tr><td class="h">108</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# restore the last method stub response</td></tr>
<tr><td class="h">109</td><td><div class="c3">129</div></td><td><div class="c3" title="T/F"><a href="blib-lib-Test-Mocha-Util-pm--branch.html#L109">100</a></div></td><td></td><td></td><td></td><td><div>136</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;if ( defined $Test::Mocha::Mock::last_response ) {</td></tr>
<tr><td class="h">110</td><td><div class="c3">2</div></td><td></td><td></td><td></td><td></td><td><div>1</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my $stub = find_stub( $mock, $method_call );</td></tr>
<tr><td class="h">111</td><td><div class="c3">2</div><div class="c3">2</div></td><td></td><td></td><td></td><td></td><td><div>2</div><div>3</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unshift @{ $stub-&gt;{responses} }, $Test::Mocha::Mock::last_response;</td></tr>
<tr><td class="h">112</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">113</td><td colspan="7"></td></tr><tr><td class="h">114</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;# remove the last method call from the invocation history</td></tr>
<tr><td class="h">115</td><td><div class="c3">129</div><div class="c3">129</div></td><td></td><td></td><td></td><td></td><td><div>63</div><div>132</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;pop @{ $mock-&gt;__calls };</td></tr>
<tr><td class="h">116</td><td colspan="7"></td></tr><tr><td class="h">117</td><td><div class="c3">129</div></td><td></td><td></td><td></td><td></td><td><div>159</div></td><td class="s">&nbsp;&nbsp;&nbsp;&nbsp;return $method_call;</td></tr>
<tr><td class="h">118</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">119</td><td colspan="7"></td></tr><tr><td class="h">120</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># sub print_call_stack {</td></tr>
<tr><td class="h">121</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">122</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Returns whether the given C&lt;$package&gt; is in the current call stack.</td></tr>
<tr><td class="h">123</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# &quot;&quot;&quot;</td></tr>
<tr><td class="h">124</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# uncoverable pod</td></tr>
<tr><td class="h">125</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my ( $message ) = @_;</td></tr>
<tr><td class="h">126</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#</td></tr>
<tr><td class="h">127</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print $message, &quot;\n&quot;;</td></tr>
<tr><td class="h">128</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my $level = 1;</td></tr>
<tr><td class="h">129</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while ( my ( $caller, $file, $line, $sub ) = caller $level++ ) {</td></tr>
<tr><td class="h">130</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;\t[$caller] $sub\n&quot;;</td></tr>
<tr><td class="h">131</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</td></tr>
<tr><td class="h">132</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;</td></tr>
<tr><td class="h">133</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># }</td></tr>
<tr><td class="h">134</td><td colspan="7"></td></tr><tr><td class="h">135</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">1;</td></tr>
</table>
</body>
</html>