Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is designed to set your module search path. Specifically, it sets the default location (first location checked) the user's local <code>perl/</code> directory. It not only adds that directory but makes it a new root for <code>@INC</code>. <strong>It does this for every entry in @INC.</strong> In a limited access environment such as those that use CPanel this insures you scripts (general cgi) user your modules over any other.</p> <p>BEGIN means it occurs before any code not in the block.</p> <p>The first line determines if <code>/home/root/perl</code> exists and is a directory. If both are true it assigns that to <code>$base_module_dir</code>, otherwise it assigns <code>&lt;user home&gt;/perl/</code> to the variable. Remember, in perl you can index a function call directly if it returns a list.</p> <p>It finds the user's home directory with <code>getpwuid($&gt;)</code>. <code>getpwuid()</code> gets user account information for a given user (generally from passwd on a Unix system) and returns it as a list. <code>$&gt;</code> is the effective user id of the script. The reason for the index of 7 is that is the location of the home directory in the list (and it is the 8th field in passwd if memory serves).</p> <p>It then prepends ALL entries in <code>@INC</code> with <code>$base_module_dir</code> and inserts those modified entries at the front of <code>@INC</code>. So it's not just adding <code>$base_module_dir</code> as a directory but is adding that as a new root for all entries in <code>@INC</code>. That's why it uses <code>map</code> instead of just adding a single entry.</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. 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