<?xml version="1.0" encoding="windows-1252"?>
<node id="568217" title="Re^3: What I Most Recently Learned in Perl, But Should Have Already Known" created="2006-08-18 12:48:50" updated="2006-08-18 08:48:50">
<type id="11">
note</type>
<author id="129417">
sfink</author>
<data>
<field name="doctext">
I always run into the problem of the default case when I use that -- what if $function isn't a key in %functions? The error message "Undefined subroutine &amp;main:: called" can be very difficult to figure out.
&lt;p&gt;
And the straightforward fix isn't all that pretty:
&lt;code&gt;
($functions{$function} || $functions{default})-&gt;();
&lt;/code&gt;
But I admit that I still use it. With comments, if there is any chance that someone with a capacity to do me bodily harm might read the code.
</field>
<field name="root_node">
567774</field>
<field name="parent_node">
567974</field>
</data>
</node>
