I didn't test it but INIT kicks in when everything is finished compiling, perlsub -
"INIT" blocks are run just before the Perl runtime begins execution, in "first in, first out" (FIFO) order. For example, the code generators documented in perlcc make use of "INIT" blocks to initialize and resolve pointers to XSUBs.

So various modules can register INIT blocks. The INIT blocks are all postponed until just before perl starts executing, at which point it runs all the INIT blocks in the order they were registered and then finally it goes to line 1 of your program.

$@ is the only place where an error from an eval will show up, if you don't do something about it, the error will disappear forever, that's what makes it possible to ignore an error with eval. Of course if there is something wrong with the module and we ignore the error, the program will probably fail anyway however it will fail with a confusing error message. For example if mod.pm is

package mod; sub foo{ print "hello world\n; # eek! missing a double quote } 1;
and we do
eval "use mod"; mod::foo();
we get
Undefined subroutine &mod::foo called at - line 2.
because foo didn't compile however what we really want is
eval "use mod"; die $@ if $@; mod::foo();
Can't find string terminator '"' anywhere before EOF at mod.pm line 3.
Compilation failed in require at (eval 1) line 2.
BEGIN failed--compilation aborted at (eval 1) line 2.

In reply to Re^3: interface.pm explained by fergal
in thread interface.pm explained by gaal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.