[kw-pm] Perlbot's ability to load/release/reload modules on the fly

Justin Wheeler pm at datademons.com
Tue Jan 28 15:54:58 CST 2003


This is probably an oversimplified answer.  Feel free to slap me if you
like.

Sounds like it's simply an eval.

open (code, "blah.mod");
@code = <code>;
close code;
$code = join("\n", @code);
eval($code);

open (code, "blah2.mod");
@code = <code>;
close code;
$code = join("\n", @);
eval($code);

... there's always more than one way to do it... but.. I would imagine
it's something along these lines.. (not that simple, of course.).. but you
get the idea.

Regards,
Justin Wheeler

-- Computer programmer (n): Red-eyed mammal capable of communicating with
	electronics and inanimate equipment.

On Tue, 28 Jan 2003, Andrew Kohlsmith wrote:

> Before I go digging and try to figure it out myself, does anyone have any
> experience with Perlbot and/or knows enough about Perl to give me a quick
> rundown on how exactly Perl (well Perlbot) it is able to dynamically load,
> reload and release Perl functions from its runtime?
>
> An example: perlbot has module a, b, c, d, e and foo. a-e are already loaded
> and functioning. I can, via IRC, tell the bot to load module 'foo' and it
> will load it up, make it active and never disconnect or restart itself.
> Similarly I can edit foo's configuration and tell it to reload, or tell
> Perlbot to release module foo, all without Perlbot stopping.
>
> The modules are just Perl code files.
>
> Regards,
> Andrew
> _______________________________________________
> kw-pm mailing list
> kw-pm at mail.pm.org
> http://mail.pm.org/mailman/listinfo/kw-pm
>




More information about the kw-pm mailing list