May be it is out of the thread but I must say a word.
Be carefull with base pragma, it will only require your base modules, not use them! So import subroutines of the base modules will be ignored.
A spot from documentation:
-----------
package Baz;
use base qw(Foo Bar);
Roughly similar in effect to
BEGIN {
require Foo;
require Bar;
push @ISA, qw(Foo Bar);
}
----------
An example:
----------
### File A.pm
package A;
sub import { warn "A imported"; }
----------
### File X.pm
package X;
use base qw(A);
sub import { warn "X imported"; }
----------
### File Y.pm
package Y;
use A;
use base qw(A);
sub import { warn "Y imported"; }
-----------
### File Z.pm
package Z;
use A;
@ISA = qw(A);
sub import { warn "Z imported"; }
----------
And now:
bash$ perl -e 'use X'
import X at X.pm line 7.
bash$ perl -e 'use Y'
import A at A.pm line 5.
import Y at Y.pm line 8.
bash$ perl -e 'use Z'
import A at A.pm line 5.
import Z at Z.pm line 9.
You can see base module A is not imported in the first case.
--
brother ab
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|