Re: pr warn die question

2007-06-02 Thread Dr.Ruud
Paul Lalli schreef: > If you have to change existing code > in order to add new code, that's the definition of not scalable. "scalable" is about "doing more of the same", along one or more axes. For example: having a webpage full of numbers, that is doing a separate database query for every nu

Re: pr warn die question

2007-06-01 Thread Paul Lalli
On Jun 1, 3:47 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > > > Thank you for proving my point for me. :-P > Umm, no, I didn't. I agreed with part of what you said. You should > never use an else with an unless, but unless by itself is better, in

Re: pr warn die question

2007-06-01 Thread Steve Bertrand
Chas Owens wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: >> On Jun 1, 1:49 pm, [EMAIL PROTECTED] (Chas Owens) wrote: >> > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:> On Jun 1, 11:21 am, >> >> > > and unscalable. (As soon as you add an 'else' clause, >> > > people have to read it

Re: pr warn die question

2007-06-01 Thread Chas Owens
On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: On Jun 1, 1:49 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:> On Jun 1, 11:21 am, > > and unscalable. (As soon as you add an 'else' clause, > > people have to read it two or three times to understand

Re: pr warn die question

2007-06-01 Thread Paul Lalli
On Jun 1, 1:49 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:> On Jun 1, 11:21 am, > > and unscalable. (As soon as you add an 'else' clause, > > people have to read it two or three times to understand what's being > > done). Avoid at all costs. > > W

Re: pr warn die question

2007-06-01 Thread Chas Owens
On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: On Jun 1, 11:21 am, [EMAIL PROTECTED] (Chas Owens) wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > snip> if (! $ftp ) { > > snip > > Ugh, use unless () {} rather than if (! ) {}. Ugh. Never. The only time unless should ever be used

Re: pr warn die question

2007-06-01 Thread Paul Lalli
On Jun 1, 11:21 am, [EMAIL PROTECTED] (Chas Owens) wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > snip> if (! $ftp ) { > > snip > > Ugh, use unless () {} rather than if (! ) {}. Ugh. Never. The only time unless should ever be used is in postfix notation, as in: die "No arguments p

Re: pr warn die question

2007-06-01 Thread Chas Owens
On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip if (! $ftp ) { snip Ugh, use unless () {} rather than if (! ) {}. snip Even more preferred would be to throw an exception, and let the calling code deal with it: my $ftp = Net::FTP->new($remote_host) or die "failed to connect to $remot

Re: pr warn die question

2007-06-01 Thread Steve Bertrand
You may want to change this line: > print LOGFILE "failed to connect to $remote_host\n" to the following: print LOGFILE "failed to connect to $remote_host: [EMAIL PROTECTED]" ...and it will print the reason why it could not connect as well. Steve -- To unsubscribe, e-mail: [EMAIL PROTEC

Re: pr warn die question

2007-06-01 Thread Paul Lalli
On Jun 1, 10:48 am, [EMAIL PROTECTED] (Ben Edwards) wrote: > I have a perl script that uses FTP. If the ftp server can not be > conected to I want to write to a log file and exit with a return code > of 1. > > Something like > > my $ftp = Net::FTP->new( $remote_host ) or { > print LOGFIL

Re: pr warn die question

2007-06-01 Thread Chas Owens
On 6/1/07, Ben Edwards <[EMAIL PROTECTED]> wrote: snip my $ftp = Net::FTP->new( $remote_host ) or { print LOGFILE "failed to connect to $remote_host\n" return(1); }; But this does not work. So how do I do 2 statements for an or? snip my $ftp = Net::FTP->new( $remote_host )

Re: pr warn die question

2007-06-01 Thread Steve Bertrand
Ben Edwards wrote: > I have a perl script that uses FTP. If the ftp server can not be > conected to I want to write to a log file and exit with a return code > of 1. > > Something like > >my $ftp = Net::FTP->new( $remote_host ) or { > print LOGFILE "failed to connect to $remote_host\n"

pr warn die question

2007-06-01 Thread Ben Edwards
I have a perl script that uses FTP. If the ftp server can not be conected to I want to write to a log file and exit with a return code of 1. Something like my $ftp = Net::FTP->new( $remote_host ) or { print LOGFILE "failed to connect to $remote_host\n" return(1); }; But this do