On Mon, Jul 14, 2003 at 11:41:40AM +0200 Hamish Whittal wrote: > Anyone know whether or how I can initialise code when calling any of the > subroutines within a module? > I don't necessarily want to call the module personally, I would like it > to be called when I call any of the subroutines.
You can have Perl initialize your code when it require()s or use()s the module. You don't even have to do much. If you add regular code to a module (that is, code that is not within a subroutine or method), it gets executed once the module is loaded. Therefore: package Module; # This is executed automatically # ------------------------------ my $var = 1; print "I am loaded\n"; # you can also call functions call_init_function(); # ------------------------------ # the rest remains as it was sub function { ... } 1; Tassilo -- $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({ pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#; $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]