title: Defering execution of a block of Perl code
body: <p>In <code>lib/MyModule.pm</code>:</p>
  
  <pre><code>package MyModule;
  DEFER: {
      print "foo";
  }
  1;
  </code></pre>
  
  <p>In <code>script.pl</code>:</p>
  
  <pre><code>use MyModule;
  print "bar";
  </code></pre>
  
  <p>I want to be able to output:</p>
  
  <pre><code>bar
  foo
  </code></pre>
  
  <p>That is, I want to defer the execution of code inside the DEFER: block into the runtime and preferably after the code in the caller is executed. Sort of the opposite of BEGIN {}. Currently I use END {}, which is pretty much the opposite of BEGIN {} I suppose, but I wonder if there are other alternatives. One of the requirements is that the caller code only wants to do <code>use MyModule</code> and nothing additional.</p>