Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
Hey David. I have no idea what just happened, I think santa brought me a present. I tried to insert some print statements here and there, and it seemed to work fine. I started removing the print's and surprisingly, everything worked?! I'm sure I'm an idiot and that I missed something, but I can sw

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: >>> On Tue, 23 Dec 2003 14:33:54 -0800, david <[EMAIL PROTECTED]> wrote: >>> exit: 0 Accept returned which shows me that the accept function doesn't exit. am i miss something? >> >>> That IS weird! I tried doing the same to the main program, but there i

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
On Tue, 23 Dec 2003 15:02:19 -0800, david <[EMAIL PROTECTED]> wrote: Jesper Noehr wrote: On Tue, 23 Dec 2003 14:33:54 -0800, david <[EMAIL PROTECTED]> wrote: exit: 0 Accept returned which shows me that the accept function doesn't exit. am i miss something? That IS weird! I tried doing the same

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: > On Tue, 23 Dec 2003 14:33:54 -0800, david <[EMAIL PROTECTED]> wrote: > >> exit: 0 >> Accept returned >> >> which shows me that the accept function doesn't exit. am i miss >> something? > That IS weird! I tried doing the same to the main program, but there it > makes no diff

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
On Tue, 23 Dec 2003 14:33:54 -0800, david <[EMAIL PROTECTED]> wrote: exit: 0 Accept returned which shows me that the accept function doesn't exit. am i miss something? That IS weird! I tried doing the same to the main program, but there it makes no difference. You got any idea what I need to mod

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: > Sure, here's an example: > > [snip] > > #!/usr/bin/perl -w > use strict; > use Mail::Audit; > use vars qw/$mail @maildata/; > BEGIN { *CORE::GLOBAL::exit = sub { my($exitcode) = shift; print "exit: > ".$exitcode; die $exitcode; } }; > > @maildata = ; > $mail = Mail::Audit-

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
Sure, here's an example: [snip] #!/usr/bin/perl -w use strict; use Mail::Audit; use vars qw/$mail @maildata/; BEGIN { *CORE::GLOBAL::exit = sub { my($exitcode) = shift; print "exit: ".$exitcode; die $exitcode; } }; @maildata = ; $mail = Mail::Audit->new(data => [EMAIL PROTECTED]); eval { $mail-

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: [snip] >> are you sure it's the exit function that cause the problem? > Yes, I am positive. As soon as I insert this into Audit.pm it works > perfectly: > use subs qw/exit/; > sub exit { die shift; } this makes sense but it doesn't make sense that the previous version doesn

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
On Tue, 23 Dec 2003 13:19:40 -0800, David Zhuo <[EMAIL PROTECTED]> wrote: i checked the source of Mail::Audit especially the accept function. there is nothing i can see why my method won't work. the only time accept calls exit directly is when a message has been sent but not when the noexit opti

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
Sorry, I forgot to send it to the list as well. Stupid mailclient. On Tue, 23 Dec 2003 13:35:48 -0800, david <[EMAIL PROTECTED]> wrote: interesting. i will take a look at the source of Mail::Audit. what function in Mail::Audit is causing the exit? do you know? The function relevant to me, is acc

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: [snip] >> if so, give Mail::Audit a chance to see the "new" exit built-in after you >> override it: >> >> BEGIN{ *CORE::GLOBAL::exit = sub { print "EXIT: " . shift } } >> >> use Mail::Audit; >> >> or: >> >> BEGIN{ >> *CORE::GLOBAL::exit = sub { print "EXIT: " . shift }

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
On Tue, 23 Dec 2003 13:28:38 -0800, david <[EMAIL PROTECTED]> wrote: let me try one more time: 1. Mail::Audit calls exit which should call your defined sub but it doesn't 2. after catching the exit call from Mail::Audit, you will CORE::exit so your script can exit. correct? Yes. That is corre

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: [snip] >> i have never used Mail::Audit so i am not familiar with it. looking at >> your >> code, i am almost certain that this: >> >> CORE::exit; > I am using CORE::exit because I _need_ the actual exit in my own program. > Mail::Audit does not call CORE::exit, it just calls

Re: CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
On Tue, 23 Dec 2003 13:07:38 -0800, David Zhuo <[EMAIL PROTECTED]> wrote: Jesper, next time when you reply, please remember to reply or CC: the group Of course, sorry. On Tuesday 23 December 2003 12:17, Jesper Noehr wrote: Hey David. Thanks for your reply. It seems you're overriding the sub with

Re: CORE::GLOBAL override question

2003-12-23 Thread David Zhuo
Jesper, next time when you reply, please remember to reply or CC: the group On Tuesday 23 December 2003 12:17, Jesper Noehr wrote: > Hey David. > > Thanks for your reply. > > It seems you're overriding the sub within a package. Is that necesarry? no. it isn't. i put it in the package just for dem

Re: CORE::GLOBAL override question

2003-12-23 Thread david
Jesper Noehr wrote: > Hey list! > > I'm having a problem with overriding a sub in CORE::GLOBAL. > I need to override exit(), and I'm doing that with: > > BEGIN { *CORE::GLOBAL::exit = sub { print "exit: ".shift; } }; > > ..which works for the program itself. > > However! When I call exit() in

CORE::GLOBAL override question

2003-12-23 Thread Jesper Noehr
Hey list! I'm having a problem with overriding a sub in CORE::GLOBAL. I need to override exit(), and I'm doing that with: BEGIN { *CORE::GLOBAL::exit = sub { print "exit: ".shift; } }; ..which works for the program itself. However! When I call exit() in a module used by my program, the module a