There's not a single compile-time. When one says "at compile-time", one means "when the containing unit (statement, block, file) is being compiled". Same goes for run time.
use A;
is basically
BEGIN {
require A;
A->import();
}
use statements and BEGIN blocks are executed as soon are they are compiled, so the following happens
- use A; is compiled.
- use A; is executed. (BEGIN blocks are executed as soon as they are compiled.)
- require A; is executed.
- If A hasn't previously been loaded,
- A is loaded and compiled.
- ...
- require Exporter; is compiled.
- @ISA = qw(Exporter); is compiled.
- @EXPORT = qw( abc ); is compiled.
- ...
- A is executed.
- ...
- require Exporter; is executed.
- If Exporter hasn't previously been loaded,
- Exporter is loaded and compiled.
- ...
- sub import { ... } is compiled.
- ...
- Exporter is executed.
- ...
- @ISA = qw(Exporter); is executed.
- @EXPORT = qw( abc ); is executed.
- ...
- A->import(); is executed.
As you can see, Exporter is loaded and its import method is compiled before your module's import is called without having to make any modifications.
(I usually use "ModA" instead of "A" because "B" is the name of an existing module.)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.