<?xml version="1.0" encoding="windows-1252"?>
<node id="992167" title="Re: Let a module call a sub of the caller" created="2012-09-06 15:11:54" updated="2012-09-06 15:11:54">
<type id="11">
note</type>
<author id="629110">
SuicideJunkie</author>
<data>
<field name="doctext">
&lt;p&gt;You can pass a reference to a sub, and let other code call that whenever you like...&lt;/p&gt;
&lt;c&gt;
use strict;
use warnings;
{
  my $subref = sub { print "Hey, Hey!\n"; };
  Foo($subref);
}
exit 0;

sub Foo
{
	my $callback = shift;
	print "Foo started\n";
	$callback-&gt;();
	print "Foo is done\n";
}
&lt;/c&gt;</field>
<field name="root_node">
992164</field>
<field name="parent_node">
992164</field>
</data>
</node>
