programlistingco.example.1.sgm   [plain text]


<!DOCTYPE programlistingco PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
<programlistingco>
<areaspec>
<areaset id="ex.plco.const" coords="">
  <area id="ex.plco.c1" coords=4>
  <area id="ex.plco.c2" coords=8>
</areaset>
<area id="ex.plco.ret" coords=12>
<area id="ex.plco.dest" coords=12>
</areaspec>
<programlisting>
sub do_nothing_useful {
    my($a, $b, $c);

    $a = new A;
    
    $a->does_nothing_either();

    $b = new B; 

    $c = "frog";

    return ($a, $c);
}
</programlisting>
<calloutlist>
<callout arearefs="ex.plco.const">
<para>
These are calls to the constructor <function>new</function> in the object
classes.
</para>
</callout>
<callout arearefs="ex.plco.ret">
<para>
This function returns a two-element list.
</para>
</callout>
<callout arearefs="ex.plco.dest">
<para>
The <emphasis>destructor</emphasis> (<function>DESTROY</function>) for
the object <literal>$b</literal> will be called automatically for this
object since there can be no other references to it outside this function.
</para>
</callout>
</calloutlist>
</programlistingco>