Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: dynamic loading of modules

by opensourcer (Monk)
on Aug 28, 2006 at 06:37 UTC ( [id://569937]=note: print w/replies, xml ) Need Help??


in reply to Re: dynamic loading of modules
in thread dynamic loading of modules

thanks for ur repply,>/br> i do undertand that, but is there any solution or work-around for this?

Replies are listed 'Best First'.
Re^3: dynamic loading of modules
by shmem (Chancellor) on Aug 28, 2006 at 08:36 UTC
    Put your assignment into the BEGIN block.

    package SearchMachine; BEGIN { $mod1 = "/path/Mysearch.pm"; require qq($mod1); } 1;
    or put it into a BEGIN block of it's own:
    package SearchMachine; BEGIN { $mod1 = "/path/Mysearch.pm"; } BEGIN { require qq($mod1); } 1;
    All BEGIN blocks are executed first, in order, before any other code is even compiled. See perlmod, section BEGIN, CHECK, INIT and END. And, for the record, it's spelled dynamic loading ;-)

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://569937]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-26 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found