[31253] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2494 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 2 18:18:30 2009

Date: Thu, 2 Jul 2009 11:36:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 2 Jul 2009     Volume: 11 Number: 2494

Today's topics:
        "next unless $vrbl" fails <sandy@atuc.net.removethistld>
    Re: "next unless $vrbl" fails <jimsgibson@gmail.com>
    Re: "next unless $vrbl" fails <sandy@atuc.net.removethistld>
        *** SExy YOung Pics BOOBS!@ <complex.easy.n13@gmail.com>
        [OT] Javascript "for in" (was Re: Best way to do server <tadmc@seesig.invalid>
    Re: [OT] Javascript "for in" (was Re: Best way to do se <mvdwege@mail.com>
    Re: [OT] Javascript "for in"  <ben@morrow.me.uk>
    Re: [OT] Javascript "for in" <mvdwege@mail.com>
        Asus <syeda.nida.manzar@gmail.com>
        Available Oracle DBA candidates for immediately <harikr.85@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 26 Jun 2009 17:34:59 GMT
From: "SandyTipper" <sandy@atuc.net.removethistld>
Subject: "next unless $vrbl" fails
Message-Id: <7F71m.32341$Db2.16669@edtnps83>

I've been stuck on this bit of illogic for days. It is stopping me dead in 
my tracks.
I have the following code (irrelevant lines omitted and replaced by ...):
--------------
COH_LOCK: {
   ...
COH_LOOP:
        for my $host_key (keys %$hosts_data_ref) {
   ...
            my $host_ok = 1;
            if ($room_number) {
                $host_ok = 0 unless exists 
$dynaroom_data_ref->{$room_number};
            }
            if ($bunch_number) {
                $host_ok = 0 unless exists 
$bunches_data_ref->{$bunch_number};
            }
            next COH_LOOP unless $host_ok;
            clean_up_host($host_key);
            $changes++;
        }#COH_LOOP
        Engine::File->save_data(+HOSTS) if $changes;
    }#COH_LOCK
----------------
Using the debugger, I broke before the "next" statement
$room_number and $bunch_number are both integers > 1
both hash elements exist
as expected, $host_ok is 1
BUT WHEN STEPPING ON, "clean_up_host" EXECUTES! WHY??




------------------------------

Date: Fri, 26 Jun 2009 10:48:28 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: "next unless $vrbl" fails
Message-Id: <260620091048288080%jimsgibson@gmail.com>

In article <7F71m.32341$Db2.16669@edtnps83>, SandyTipper
<sandy@atuc.net.removethistld> wrote:

> I've been stuck on this bit of illogic for days. It is stopping me dead in 
> my tracks.
> I have the following code (irrelevant lines omitted and replaced by ...):
> --------------
> COH_LOCK: {
>    ...
> COH_LOOP:
>         for my $host_key (keys %$hosts_data_ref) {
>    ...
>             my $host_ok = 1;
>             if ($room_number) {
>                 $host_ok = 0 unless exists 
> $dynaroom_data_ref->{$room_number};
>             }
>             if ($bunch_number) {
>                 $host_ok = 0 unless exists 
> $bunches_data_ref->{$bunch_number};
>             }
>             next COH_LOOP unless $host_ok;
>             clean_up_host($host_key);
>             $changes++;
>         }#COH_LOOP
>         Engine::File->save_data(+HOSTS) if $changes;
>     }#COH_LOCK
> ----------------
> Using the debugger, I broke before the "next" statement
> $room_number and $bunch_number are both integers > 1
> both hash elements exist
> as expected, $host_ok is 1
> BUT WHEN STEPPING ON, "clean_up_host" EXECUTES! WHY??

'unless' is equivalent to 'if not', so the statement

  next COH_LOOP unless $host_ok;

will execute the 'next' if $host_ok is 'not true'. Since $host_ok is 1
(true), the next is not executed, and the program executes the
clean_up_host in the next line. Perhaps you want:

  next COH_LOOP if $host_ok;

HTH.

-- 
Jim Gibson


------------------------------

Date: Fri, 26 Jun 2009 17:54:43 GMT
From: "SandyTipper" <sandy@atuc.net.removethistld>
Subject: Re: "next unless $vrbl" fails
Message-Id: <DX71m.32343$Db2.9942@edtnps83>

"Jim Gibson" <jimsgibson@gmail.com> wrote in message 
news:260620091048288080%jimsgibson@gmail.com...
> In article <7F71m.32341$Db2.16669@edtnps83>, SandyTipper
> <sandy@atuc.net.removethistld> wrote:
>
>> I've been stuck on this bit of illogic for days. It is stopping me dead 
>> in
>> my tracks.
>> I have the following code (irrelevant lines omitted and replaced by ...):
>> --------------
>> COH_LOCK: {
>>    ...
>> COH_LOOP:
>>         for my $host_key (keys %$hosts_data_ref) {
>>    ...
>>             my $host_ok = 1;
>>             if ($room_number) {
>>                 $host_ok = 0 unless exists
>> $dynaroom_data_ref->{$room_number};
>>             }
>>             if ($bunch_number) {
>>                 $host_ok = 0 unless exists
>> $bunches_data_ref->{$bunch_number};
>>             }
>>             next COH_LOOP unless $host_ok;
>>             clean_up_host($host_key);
>>             $changes++;
>>         }#COH_LOOP
>>         Engine::File->save_data(+HOSTS) if $changes;
>>     }#COH_LOCK
>> ----------------
>> Using the debugger, I broke before the "next" statement
>> $room_number and $bunch_number are both integers > 1
>> both hash elements exist
>> as expected, $host_ok is 1
>> BUT WHEN STEPPING ON, "clean_up_host" EXECUTES! WHY??
>
> 'unless' is equivalent to 'if not', so the statement
>
>  next COH_LOOP unless $host_ok;
>
> will execute the 'next' if $host_ok is 'not true'. Since $host_ok is 1
> (true), the next is not executed, and the program executes the
> clean_up_host in the next line. Perhaps you want:
>
>  next COH_LOOP if $host_ok;
>
> HTH.
>
> -- 
> Jim Gibson

DOH! Ever wish you could unsend?
I got twisted up in all the negative logic and too little sleep.
Thanks for answering such a dumb question.

Sandy 




------------------------------

Date: Fri, 26 Jun 2009 10:52:18 -0700 (PDT)
From: Stuffit 52 <complex.easy.n13@gmail.com>
Subject: *** SExy YOung Pics BOOBS!@
Message-Id: <2e831d99-b50d-4dc0-85fd-33bbd0899652@f38g2000pra.googlegroups.com>

http://sweetyoungtits.blogspot.com/2009/06/ge-announces-new-touchscreen.html
- great hi res images of beautiful hot young tits! Free Download!


------------------------------

Date: Wed, 01 Jul 2009 06:57:54 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: [OT] Javascript "for in" (was Re: Best way to do server side tasks with new ISP)
Message-Id: <slrnh4mjjj.nj.tadmc@tadmc30.sbcglobal.net>

Mart van de Wege <mvdwege@mail.com> wrote:
> Ben Morrow <ben@morrow.me.uk> writes:
>
>> Quoth "Paul E. Schoen" <paul@peschoen.com>:
>>
>> (Notice how Perl makes the rather common operation of 'iterate over all
>> the entries in a list' much easier than JS does. JS 1.6 has
>>
>>     entries.forEach(function { print(...) });
>>
>> but that isn't exactly pretty.)
>>
>
> Erm.
>
> JavaScript 1.5 *does* have the equivalent construct: 
>
> 'for (var in list)'.


But that iterates over the entire prototype chain:

    http://yuiblog.com/blog/2006/09/26/for-in-intrigue/


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Wed, 01 Jul 2009 22:04:17 +0200
From: Mart van de Wege <mvdwege@mail.com>
Subject: Re: [OT] Javascript "for in" (was Re: Best way to do server side tasks with new ISP)
Message-Id: <86skhg5fwe.fsf@gareth.avalon.lan>

Tad J McClellan <tadmc@seesig.invalid> writes:

> Mart van de Wege <mvdwege@mail.com> wrote:
>> Ben Morrow <ben@morrow.me.uk> writes:
>>
>>> Quoth "Paul E. Schoen" <paul@peschoen.com>:
>>>
>>> (Notice how Perl makes the rather common operation of 'iterate over all
>>> the entries in a list' much easier than JS does. JS 1.6 has
>>>
>>>     entries.forEach(function { print(...) });
>>>
>>> but that isn't exactly pretty.)
>>>
>>
>> Erm.
>>
>> JavaScript 1.5 *does* have the equivalent construct: 
>>
>> 'for (var in list)'.
>
>
> But that iterates over the entire prototype chain:
>
>     http://yuiblog.com/blog/2006/09/26/for-in-intrigue/

If you use an object to iterate over, yes. If you feed it an array, it
works the same as Perl's foreach.

Of course, since you can add properties to just about anything, you can
never be sure if you're actually iterating over an array. Javascript is
a bit quirky in that. But to me, it feels remarkably close to Perl,
funnily enough.

Mart

-- 
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.


------------------------------

Date: Wed, 1 Jul 2009 21:49:42 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: [OT] Javascript "for in" 
Message-Id: <6oush6-rh81.ln1@osiris.mauzo.dyndns.org>


Quoth Mart van de Wege <mvdwege@mail.com>:
> Tad J McClellan <tadmc@seesig.invalid> writes:
> 
> > Mart van de Wege <mvdwege@mail.com> wrote:
> >> Ben Morrow <ben@morrow.me.uk> writes:
> >>
> >>> Quoth "Paul E. Schoen" <paul@peschoen.com>:
> >>>
> >>> (Notice how Perl makes the rather common operation of 'iterate over all
> >>> the entries in a list' much easier than JS does. JS 1.6 has
> >>>
> >>>     entries.forEach(function { print(...) });
> >>>
> >>> but that isn't exactly pretty.)
> >>>
> >>
> >> Erm.
> >>
> >> JavaScript 1.5 *does* have the equivalent construct: 
> >>
> >> 'for (var in list)'.
> >
> > But that iterates over the entire prototype chain:
> >
> >     http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
> 
> If you use an object to iterate over, yes. If you feed it an array, it
> works the same as Perl's foreach.

Bzzzt! Wrong. Arrays are objects in JS, so anything added to
Array.prototype or Object.prototype will show up in the Array's
properties.

> Of course, since you can add properties to just about anything, you can
> never be sure if you're actually iterating over an array.

 ...quite. The lack of lists is one of the things I find most annoying
about JS (well, that and refs, and the fact 'function' has such a long
name).

> Javascript is a bit quirky in that. But to me, it feels remarkably
> close to Perl, funnily enough.

It does, doesn't it? I think it's having both hashes and lexical closure
that does it.

Ben



------------------------------

Date: Thu, 02 Jul 2009 08:01:21 +0200
From: Mart van de Wege <mvdwege@mail.com>
Subject: Re: [OT] Javascript "for in"
Message-Id: <86vdmb4o9a.fsf@gareth.avalon.lan>

Ben Morrow <ben@morrow.me.uk> writes:

> Quoth Mart van de Wege <mvdwege@mail.com>:
>> Tad J McClellan <tadmc@seesig.invalid> writes:
>> 
>> > Mart van de Wege <mvdwege@mail.com> wrote:
>> >> Ben Morrow <ben@morrow.me.uk> writes:
>> >>
>> >>> Quoth "Paul E. Schoen" <paul@peschoen.com>:
>> >>>
>> >>> (Notice how Perl makes the rather common operation of 'iterate over all
>> >>> the entries in a list' much easier than JS does. JS 1.6 has
>> >>>
>> >>>     entries.forEach(function { print(...) });
>> >>>
>> >>> but that isn't exactly pretty.)
>> >>>
>> >>
>> >> Erm.
>> >>
>> >> JavaScript 1.5 *does* have the equivalent construct: 
>> >>
>> >> 'for (var in list)'.
>> >
>> > But that iterates over the entire prototype chain:
>> >
>> >     http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
>> 
>> If you use an object to iterate over, yes. If you feed it an array, it
>> works the same as Perl's foreach.
>
> Bzzzt! Wrong. Arrays are objects in JS, so anything added to
> Array.prototype or Object.prototype will show up in the Array's
> properties.
>
Well yeah. It pays to read further than a single paragraph, doesn't it?

>> Of course, since you can add properties to just about anything, you can
>> never be sure if you're actually iterating over an array.

<snip>

>> Javascript is a bit quirky in that. But to me, it feels remarkably
>> close to Perl, funnily enough.
>
> It does, doesn't it? I think it's having both hashes and lexical closure
> that does it.
>
For me, the fact that objects are merely hashes of properties felt very
familiar. The canonical Perl object is conceptually not much
different. Of course, as soon as you start using prototypical
inheritance, Javascript shows its differences, but the starting point is
remarkably similar.

Mart

-- 
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.


------------------------------

Date: Fri, 26 Jun 2009 05:25:13 -0700 (PDT)
From: Syed Nida Manzar <syeda.nida.manzar@gmail.com>
Subject: Asus
Message-Id: <77b12972-371e-4602-a6bf-68f9f1c61624@n21g2000vba.googlegroups.com>

Strengths: hello friends: we are a large international wholesaler, in
the fields of Electrical appliance.for : ipod ,cameras, cellphone,
LCD, laptops, GPS, PSP ,coffee machine .music .games .PS3 .IPHONE .and
so on.we will offer the original goods of the most competitive price
and the best quality.that all in stock . Welcome to asking and order,
please don=E2=80=99t hesitate to contact us if you are interested in our
product. Website: http://www.maxkeyer.com/ MSN:maxkeyer@hotmail.com
EMAIL:maxkeyer@yahoo.com SKYPE:saleps333


For more info Visit : http://technocityy.blogspot.com/2009/06/asus-eee-pc-1=
000he.html


------------------------------

Date: Fri, 26 Jun 2009 09:20:00 -0700 (PDT)
From: nani <harikr.85@gmail.com>
Subject: Available Oracle DBA candidates for immediately
Message-Id: <d83ac20b-08b2-4d77-9395-77d4615f8765@c20g2000prh.googlegroups.com>


Contact  Immediately :

 Hari Krishna
 Ph : 972-332-3471 Ext: 106
 Yahoo ID ! harikr_85@yahoo.com
 G Talk     ! harikr.85@gmail.com


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2494
***************************************


home help back first fref pref prev next nref lref last post