Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'm not very good at Perl (yet, i hope) and i was wondering if there's a way to create a sub that behaves like a built-in function.
This is my situation: I have a module "global" in which a sub "compress" is defined. I use this module from the main package, and my program calls other modules at runtime. Is there a way to make the "compress" behave like a built-in function so that i don't have to use the "global" module from the called modules? It uses different files: - GLOBAL.pm: in which the compress sub is stored - script.pl: the main script - module_a.pm: some random module which uses compress - module_b.pm: etc. I guess i have to use the Exporter module in some way, but that only seems to let a package that uses the "global" module. Is this a 'correct' way to program or is it morally wrong and should i just use "GLOBAL->compress" instead of trying to call it with "compress" each time? Thanks in advance! ;] In reply to Create a built-in-like sub? by mirg drol
|
|