Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[10705] trunk/src/lib/Sympa/Instruction.pm: [dev] load dependencies at runtime, and only if needed

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[10705] trunk/src/lib/Sympa/Instruction.pm: [dev] load dependencies at runtime, and only if needed
  • Date: Fri, 6 Jun 2014 15:45:34 +0900

Guillaume,

On Wed, 28 May 2014 13:18:52 +0200
Guillaume Rousse <address@concealed> wrote:

> Le 27/05/2014 15:54, IKEDA Soji a écrit :
> > Hi,
> >
> > How about using Class::Autouse?
> That would seem merely hiding the dust behind the carpet, at the cost of
> additional external code moreover.
>
> I prefer to adresse the actual problem at the source, and find some way
> to pass the relevant parameters directly. Just passing a Sympa::Site
> instance, or using a global $main::site instance, for instance, would be
> enough in most cases.

I wish to keep "logs_failed" notification feature in log module.
Log module looks being used by most of other modules including Site.

So, I at first did like:

use Sympa::Site;
use Sympa::Logger;

my $logger = Sympa::Logger->instance;
$logger->set_options(
log_level => Sympa::Site->log_level,

# Other options...

fault_handler => sub {
Sympa::Site->send_notify_to_listmaster('logs_failed');
}
);

# The first speech
$logger->do_log('notice', 'MYDAEMON started');

Sympa::Logger need not use Sympa::Site explicitly. Alternatively,
if syslog is broken, Sympa::Logger::do_log() would call fault_handler.

...However, this solution is essentially not neccessary. Anytime
when do_log() is called, inevitablly Sympa::Site has been loaded.
Sympa::Logger can freely call send_notify_to_listmaster() by itself.


I think the situation is same on task instruction. When the task is
running, is it possible that the module like Sympa::List has not been
loaded?


Regards,

--- Soji


--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/



Archive powered by MHonArc 2.6.19+.

Top of Page