Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) Dereference the reference before calling it:</p> <pre><code>${$dll_class-&gt;{MY_DLL}}-&gt;launch(); </code></pre> <p>By using <code>\$</code>, you are taking a scalar reference. <code>${...}</code> is the scalar <em>de</em>reference operator.</p> <p>I'm unsure why you need to use a reference to a reference at all - you could simply set MY_DLL to <code>$my_dll</code>, as it is already a reference:</p> <pre><code># ... my $self = { MY_DLL =&gt; $my_dll, # note, the \ is no longer in front of $my_dll }; # ... </code></pre> <p>and then you could call it with your original syntax:</p> <pre><code>$dll_class-&gt;{MY_DLL}-&gt;launch(); </code></pre> <p>2) Perl will automatically clean up anything that has no references pointing to it. When your object is destroyed, <code>\$my_dll</code> will no longer have references to it, and therefore neither will <code>$my_dll</code>, so it will be destroyed automatically.</p> <p>In general you only need to worry if you have recursive data structures that point to themselves. In those cases you use <code>DESTROY</code> to break the links manually; in your case, you do not need to explicitly set the handle to undef.</p> <p>For more information on references, see <a href="http://perldoc.perl.org/perlref.html" rel="nofollow noreferrer">perlref</a>. For information on garbage collecting, the DESTROY method and circular references, see the "Destructors" section of <a href="http://perldoc.perl.org/perlobj.html#Destructors" rel="nofollow noreferrer">perlobj</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload