RE: PerlModule options?
Hi again Stas Perrin, So, its a no-can-do then. I'll keep putting the use in every module to import the symbols in the proper namespace. Alternatively I guess I could probably use the functions with fully qualfied name Apache::ReadConfig::myFunction(), however this would add extra typing and this is exactly what I was trying to escape from. Thanks everyone for your time and kind answers. Cheers, Lian Sebe, M.Sc. Freelance Analyst-Programmer www.programEz.net -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 7:08 PM To: Mike P. Mikhailov Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: PerlModule options? Mike P. Mikhailov wrote: Hello [EMAIL PROTECTED], Tuesday, August 05, 2003, 2:55:52 PM, you wrote: cfr Hi list, cfr One questions for the braves ;-) cfr As I understand, the directive cfr PerlModule Foo::Bar cfr loads the module but doesn't import the symbols since it is equivalent to cfr the use Foo::Bar (). Therefore I should use use Foo::Bar in each program cfr only to make the import. cfr Is there other way to load the module and import the symobols specified in cfr @EXPORT at mod_perl reloading time, without adding a special line in each cfr and every script using them? cfr Perhaps some options passed to PerlModule though adding (...) doesn't help cfr since PerlModule expects a list of modules. I think this will work perl use Foo::Bar qw ( ... whatever you want to import ... ); /perl I think Lian was asking how to import symbols into his scripts/handlers at the server startup. Lian, you *must* put the special line in each and every script you want the symbols to be exported to, because exporting happens inside the script's namespace, which is no main:: under Apache::Registry, but special for each script. You can preload registry scripts using Apache::RegistryLoader, but this doesn't remove the need for an explicit import. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: PerlModule options?
Mike P. Mikhailov wrote: Hello [EMAIL PROTECTED], Tuesday, August 05, 2003, 2:55:52 PM, you wrote: cfr Hi list, cfr One questions for the braves ;-) cfr As I understand, the directive cfr PerlModule Foo::Bar cfr loads the module but doesn't import the symbols since it is equivalent to cfr the use Foo::Bar (). Therefore I should use use Foo::Bar in each program cfr only to make the import. cfr Is there other way to load the module and import the symobols specified in cfr @EXPORT at mod_perl reloading time, without adding a special line in each cfr and every script using them? cfr Perhaps some options passed to PerlModule though adding (...) doesn't help cfr since PerlModule expects a list of modules. I think this will work perl use Foo::Bar qw ( ... whatever you want to import ... ); /perl I think Lian was asking how to import symbols into his scripts/handlers at the server startup. Lian, you *must* put the special line in each and every script you want the symbols to be exported to, because exporting happens inside the script's namespace, which is no main:: under Apache::Registry, but special for each script. You can preload registry scripts using Apache::RegistryLoader, but this doesn't remove the need for an explicit import. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: PerlModule options?
On Tue, 2003-08-05 at 04:55, [EMAIL PROTECTED] wrote: loads the module but doesn't import the symbols since it is equivalent to the use Foo::Bar (). Therefore I should use use Foo::Bar in each program only to make the import. Correct. Is there other way to load the module and import the symobols specified in @EXPORT at mod_perl reloading time, without adding a special line in each and every script using them? No, that would be Bad. By putting a use Foo in each module that wants to import functions from Foo, you are explicitly saying please pollute my namespace to Foo. That sort of thing shouldn't happen unless you request it. Perhaps some options passed to PerlModule though adding (...) doesn't help since PerlModule expects a list of modules. There's no way it could since PerlModule has no way of knowing what namespaces you are going to want polluted. - Perrin
RE: PerlModule options?
Hello Mike, Thanks for your answer, this should do it indeed. Super! Somehow I didn't think about perl sections... Thanks again, Lian Sebe, M.Sc. Freelance Analyst-Programmer www.programEz.net -Original Message- From: Mike P. Mikhailov [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 2:23 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: PerlModule options? Hello [EMAIL PROTECTED], Tuesday, August 05, 2003, 2:55:52 PM, you wrote: cfr Hi list, cfr One questions for the braves ;-) cfr As I understand, the directive cfr PerlModule Foo::Bar cfr loads the module but doesn't import the symbols since it is equivalent to cfr the use Foo::Bar (). Therefore I should use use Foo::Bar in each program cfr only to make the import. cfr Is there other way to load the module and import the symobols specified in cfr @EXPORT at mod_perl reloading time, without adding a special line in each cfr and every script using them? cfr Perhaps some options passed to PerlModule though adding (...) doesn't help cfr since PerlModule expects a list of modules. cfr Thanks a bunch, cfr Lian Sebe, M.Sc. cfr Freelance Analyst-Programmer cfr www.programEz.net I think this will work perl use Foo::Bar qw ( ... whatever you want to import ... ); /perl -- WBR, Mike P. Mikhailov mailto: [EMAIL PROTECTED] ICQ:280990142 I believe in God, only I spell it Nature.
Re: PerlModule options?
Hello [EMAIL PROTECTED], Tuesday, August 05, 2003, 2:55:52 PM, you wrote: cfr Hi list, cfr One questions for the braves ;-) cfr As I understand, the directive cfr PerlModule Foo::Bar cfr loads the module but doesn't import the symbols since it is equivalent to cfr the use Foo::Bar (). Therefore I should use use Foo::Bar in each program cfr only to make the import. cfr Is there other way to load the module and import the symobols specified in cfr @EXPORT at mod_perl reloading time, without adding a special line in each cfr and every script using them? cfr Perhaps some options passed to PerlModule though adding (...) doesn't help cfr since PerlModule expects a list of modules. cfr Thanks a bunch, cfr Lian Sebe, M.Sc. cfr Freelance Analyst-Programmer cfr www.programEz.net I think this will work perl use Foo::Bar qw ( ... whatever you want to import ... ); /perl -- WBR, Mike P. Mikhailov mailto: [EMAIL PROTECTED] ICQ:280990142 I believe in God, only I spell it Nature.
RE: PerlModule options?
On Tue, 2003-08-05 at 15:57, [EMAIL PROTECTED] wrote: Thanks for your answer, this should do it indeed. Super! Somehow I didn't think about perl sections... Perl sections will not work for this. If you do it there, the symbols you want will only get imported into the Apache::ReadConfig namespace. You will not be able to call them in other scripts without importing them there too. - Perrin
Re: PerlModule options?
[EMAIL PROTECTED] wrote: Hi again Stas Perrin, So, its a no-can-do then. I'll keep putting the use in every module to import the symbols in the proper namespace. Alternatively I guess I could probably use the functions with fully qualfied name Apache::ReadConfig::myFunction(), however this would add extra typing and this is exactly what I was trying to escape from. Thanks everyone for your time and kind answers. You can define your export symbols in @EXPORT and they will be all exported by default, on 'use Module;'. See the Exporter manpage for more details. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: PerlModule options?
Hi Perrin, I see your point. However I'm speaking about one simple templating module exporting 2 functions that are used to generate HTML in every other module on the server. So it'll be pollution but bearable ;-) Thank you, Lian Sebe, M.Sc. Freelance Analyst-Programmer www.programEz.net -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 8:29 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: PerlModule options? On Tue, 2003-08-05 at 04:55, [EMAIL PROTECTED] wrote: loads the module but doesn't import the symbols since it is equivalent to the use Foo::Bar (). Therefore I should use use Foo::Bar in each program only to make the import. Correct. Is there other way to load the module and import the symobols specified in @EXPORT at mod_perl reloading time, without adding a special line in each and every script using them? No, that would be Bad. By putting a use Foo in each module that wants to import functions from Foo, you are explicitly saying please pollute my namespace to Foo. That sort of thing shouldn't happen unless you request it. Perhaps some options passed to PerlModule though adding (...) doesn't help since PerlModule expects a list of modules. There's no way it could since PerlModule has no way of knowing what namespaces you are going to want polluted. - Perrin