Re: using $! for die()ing with Package function

2004-12-02 Thread JupiterHost.Net
I think as long as a failed open() or mkdir() (IE a system function that does $! sets it already) then that is all I need for this project: sub baz { mkdir '/dir/I/cant/make' or return; } will do what i need: baz or die $!; Actually mkdir returns true or false - sub baz{return mkdir '/dir/I/ca

RE: using $! for die()ing with Package function

2004-12-02 Thread Ron Goral
> -Original Message- > From: JupiterHost.Net [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 02, 2004 7:15 PM > To: [EMAIL PROTECTED] > Subject: Re: using $! for die()ing with Package function > > > > > Paul Johnson wrote: > > > O

Re: using $! for die()ing with Package function

2004-12-02 Thread JupiterHost.Net
Paul Johnson wrote: On Thu, Dec 02, 2004 at 05:59:49PM -0600, JupiterHost.Net wrote: if I make a module, say Foobar.pm how do you make it so if a function returns false you can die $!; ? You can't. Or at least not in the sense you want. $! is linked to the current value of errno, which will be

Re: using $! for die()ing with Package function

2004-12-02 Thread JupiterHost.Net
JupiterHost.Net wrote: Jonathan Paton wrote: if I make a module, say Foobar.pm how do you make it so if a function returns false you can die $!; ? Return undef or 0, just like you are doing. Both your calls to baz have an argument, so 1 is returned both times. I prefer undef for false. Thank

Re: using $! for die()ing with Package function

2004-12-02 Thread Jonathan Paton
perldoc Carp; If that doesn't do what you want, then: perldoc -f eval else just set $@ and return undef. This is a bad solution I think. Jonathan Paton -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: using $! for die()ing with Package function

2004-12-02 Thread Paul Johnson
On Thu, Dec 02, 2004 at 05:59:49PM -0600, JupiterHost.Net wrote: > if I make a module, say Foobar.pm how do you make it so if a function > returns false you can die $!; ? You can't. Or at least not in the sense you want. $! is linked to the current value of errno, which will be set in the unde

Re: using $! for die()ing with Package function

2004-12-02 Thread JupiterHost.Net
Jonathan Paton wrote: if I make a module, say Foobar.pm how do you make it so if a function returns false you can die $!; ? Return undef or 0, just like you are doing. Both your calls to baz have an argument, so 1 is returned both times. I prefer undef for false. Thanks Jonathan for the input,

Re: using $! for die()ing with Package function

2004-12-02 Thread Jonathan Paton
> if I make a module, say Foobar.pm how do you make it so if a function > returns false you can die $!; ? Return undef or 0, just like you are doing. Both your calls to baz have an argument, so 1 is returned both times. I prefer undef for false. Jonathan Paton -- To unsubscribe, e-mail: [EMAI