[32098] in Perl-Users-Digest
Perl-Users Digest, Issue: 3362 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 22 16:09:23 2011
Date: Fri, 22 Apr 2011 13:09:08 -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 Fri, 22 Apr 2011 Volume: 11 Number: 3362
Today's topics:
Re: FAQ 4.44 How do I test whether two arrays or hashes <john@castleamber.com>
Re: FAQ 4.44 How do I test whether two arrays or hashes <rvtol+usenet@xs4all.nl>
Re: for @{ my $x } on Perl 5.10 (bug?) <john@castleamber.com>
Re: fork and blocking... (Jens Thoms Toerring)
Re: grabbing a facebook group <john@castleamber.com>
Re: grabbing a facebook group <tzz@lifelogs.com>
Re: grabbing a facebook group <john@castleamber.com>
Re: grabbing a facebook group <tadmc@seesig.invalid>
Re: grabbing a facebook group <mvdwege@mail.com>
Re: grabbing a facebook group <john@castleamber.com>
Re: grabbing a facebook group <sherm.pendley@gmail.com>
Re: grabbing a facebook group <sherm.pendley@gmail.com>
Re: grabbing a facebook group <tadmc@seesig.invalid>
Re: grabbing a facebook group <hjp-usenet2@hjp.at>
Re: grabbing a facebook group <john@castleamber.com>
Re: grabbing a facebook group <john@castleamber.com>
Re: Spreadsheet::WriteExcel, can't write to returned ob <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Apr 2011 08:37:05 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: FAQ 4.44 How do I test whether two arrays or hashes are equal?
Message-Id: <878vv2quf2.fsf@castleamber.com>
"John Small" <zjsmallz@os2world.net> writes:
> But all the elements in the arrays being compared in this particular
> program are all single "words". For this situation "@array1" eq
> "@array2" does seem to work. Is there any reason to think "@array1" eq
> "@array2" would not work under these conditions?
If these conditions always hold, it will always work. Note that the FAQ
answer has also specific conditions, and fails if those conditions don't
hold.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 18:27:43 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: FAQ 4.44 How do I test whether two arrays or hashes are equal?
Message-Id: <4db1ac7f$0$81476$e4fe514c@news.xs4all.nl>
On 2011-04-21 13:07, John Small wrote:
> if ("@array1" eq "@array2") ...
>
> This seems to work for me.
Having parallel arrays is often a design flaw.
Replace for example by a hash, where the value is a counter.
perl -MData::Dumper -MList::MoreUtils=uniq -wle '
my @old = qw/ a b c d e f g h i j /;
my @new = qw/ 2 7 d e j k l /;
my %uniq;
++$_ for @uniq{ @old };
--$_ for @uniq{ @new };
delete @uniq{ grep !$uniq{ $_ }, keys %uniq };
print Dumper( \%uniq );
print uniq sort @old, @new;
'
--
Ruud
------------------------------
Date: Fri, 22 Apr 2011 09:38:24 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: for @{ my $x } on Perl 5.10 (bug?)
Message-Id: <87ipu69wrj.fsf@castleamber.com>
John Bokma <john@castleamber.com> writes:
> "C.DeRykus" <derykus@gmail.com> writes:
>
>> On Apr 20, 12:53 pm, John Bokma <j...@castleamber.com> wrote:
>>> perl -e 'use strict; use warnings; print for @{ my $x }'
>>> Can't use an undefined value as an ARRAY reference at -e line 1.
>>>
>>> This is perl, v5.8.8 built for x86_64-linux-thread-multi
>>>
>>> perl -e 'use strict; use warnings; print for @{ my $x }'
>>>
>>> This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
>>>
>>> Is this a known bug? At least, I assume that the latter working is a bug.
>>>
>>
>> Same with 5.12.2:
>>
>> perl -Mstrict -wle "print if @{my $x}"
>> Can't use an undefined value as an ARRAY reference at -e line 1.
>>
>> perl -Mstrict -wle "print for @{my $x}"
>>
>> At the very least it seems quirky that the
>> former fails and the latter doesn't.
>
> Thanks Charles, I've reported it using perlbug.
http://rt.perl.org/rt3/Ticket/Display.html?id=89024
It looks like it's a feature. Haven't checked the change logs yet, but I
have the feeling that this was done to make
my $x->{ foo } = 3;
work (which I am OK with), and as a side effect (?) makes also:
perl -e 'use strict; use warnings; print for @{ my $x }'
perl -e 'use strict; use warnings; my $x; sub foo { my @bar = @_; };
foo( @{ my $x } );'
work (and probably some other things I forgot).
I was leaning towards a bug (when I knew about the for issue), but no
longer so sure. It does sound logical, the new way, but it makes also
IMO Perl a little more magic.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: 22 Apr 2011 13:59:15 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: fork and blocking...
Message-Id: <91dftjFr4cU1@mid.uni-berlin.de>
Tom <zihav@yahoo.com> wrote:
> ... The forking is working fine, however my
> blocking isn't... It gets the first 5 off fine but never decrements
> the counter I'm using for blocking. Is there a better way than using a
> counter?
> my @childs;
> my @FILESYSTEMS=("Alienbrain_Proxy", "programs", "cae", "codesign",
> "eng", "Gold_Build_Patches", "Gold_Builds", "Gold_Patches", "hwdev",
> "Media_Shares");
> $blockcount = 0;
> foreach $item ( @FILESYSTEMS ) {
> $blockcount++;
> print "$item\n";
> while ( $blockcount > 4 ) {
> print "$blockcount\n";
> sleep 1;
> }
> my $pid = fork();
> if ($pid) {
> # parent
> # print "pid is $pid, parent $$\n";
> push(@childs, $pid);
> } elsif ($pid == 0) {
> # child
> fsize ("$item");
> $blockcount--;
Decrementing '$blockcount' is done in the child process,
which is a completely independend process with its own
memory. So the '$blockcount' variabe within this pro-
cess has no connection to that in the parent process.
Thus '$blockcount' gets only incremented in the parent
and never decremented.
One way this could be handled would be to install a signal
handler in the parent process for SIGCHLD signals and de-
crement '$blockcount' in there. I.e. add a line like
$SIG{ CHLD } = sub { $blockcount-- };
before you start the loop. That should do the trick (at least
on UNIX, I have no idea how Windows works in this respect).
And unless you want to avoid mixing the output for childs
created and exited, you could do the waitpid() call directly
in the signal handler
$SIG{ CHLD } = sub { while ( ( my $tmp = waitpid( -1, WNOHANG ) ) > 0 ) {
print "Done with pid $tmp\n";
exit 0 if --$blockcount == 0 ;
}
};
If you do that you need to 'use POSIX;' for the definition
of 'WNOHANG' and you need to replace the loop where you now
wait for all childs to finally exit with something like
pause while 1;
Don't do
pause while $blockcount,
but exit from the signal handler or you risk a so-called
race condition. That's because between the check here if
'$blockcount' is still larger than 0 and the start of the
pause() function a SIGCHLD signal could arrive that results
in '$blockcount' finally becoming 0. In that (not verly
likely but still possible) case the program would hang
forever.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Fri, 22 Apr 2011 08:35:40 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: grabbing a facebook group
Message-Id: <87d3kequhf.fsf@castleamber.com>
Tad McClellan <tadmc@seesig.invalid> writes:
> Uno <Uno@example.invalid> wrote:
>
>> I've decided that c.l.p.misc has problems I don't want
>> to be a part of.
>
> Yeah.
>
> A place that exposes poseurs makes the poseurs want to leave.
>
> That is the good kind of "problem"!
This attidude also pisses of other people as well. I don't know if you
have noticed it, but it's getting awfully quiet in here. I've been out
of this group because of this reason, the attidude of /you/ and some
others. Keep it going, and I am out again, and soon enough it will be
very quiet in here...
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 09:27:25 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: grabbing a facebook group
Message-Id: <87r58unyya.fsf@lifelogs.com>
On Fri, 22 Apr 2011 08:35:40 -0500 John Bokma <john@castleamber.com> wrote:
JB> Tad McClellan <tadmc@seesig.invalid> writes:
>> Uno <Uno@example.invalid> wrote:
>>
>>> I've decided that c.l.p.misc has problems I don't want
>>> to be a part of.
>>
>> Yeah.
>>
>> A place that exposes poseurs makes the poseurs want to leave.
>>
>> That is the good kind of "problem"!
JB> This attidude also pisses of other people as well. I don't know if you
JB> have noticed it, but it's getting awfully quiet in here. I've been out
JB> of this group because of this reason, the attidude of /you/ and some
JB> others. Keep it going, and I am out again, and soon enough it will be
JB> very quiet in here...
Seconded. Tad is having a bad week or something, but Uri has been
handing out the tough love for a while. Let's keep it civil, guys.
(Also: Death of Usenet, tune in at 11!)
Ted
------------------------------
Date: Fri, 22 Apr 2011 09:33:19 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: grabbing a facebook group
Message-Id: <87mxji9x00.fsf@castleamber.com>
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Fri, 22 Apr 2011 08:35:40 -0500 John Bokma <john@castleamber.com> wrote:
>
> JB> Tad McClellan <tadmc@seesig.invalid> writes:
>>> Uno <Uno@example.invalid> wrote:
>>>
>>>> I've decided that c.l.p.misc has problems I don't want
>>>> to be a part of.
>>>
>>> Yeah.
>>>
>>> A place that exposes poseurs makes the poseurs want to leave.
>>>
>>> That is the good kind of "problem"!
>
> JB> This attidude also pisses of other people as well. I don't know if you
> JB> have noticed it, but it's getting awfully quiet in here. I've been out
> JB> of this group because of this reason, the attidude of /you/ and some
> JB> others. Keep it going, and I am out again, and soon enough it will be
> JB> very quiet in here...
>
> Seconded. Tad is having a bad week or something, but Uri has been
> handing out the tough love for a while. Let's keep it civil, guys.
Thanks Ted ;-)
> (Also: Death of Usenet, tune in at 11!)
Heh, I have been saying that too, like: there are still more people on
Usenet compared to the early 90's. However, I was quite shocked, to be
honest, to see how little has been posted here the past days.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 09:48:35 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: grabbing a facebook group
Message-Id: <slrnir3519.5es.tadmc@tadbox.sbcglobal.net>
Ted Zlatanov <tzz@lifelogs.com> wrote:
> Let's keep it civil, guys.
Imply that I an on drugs again, and I will be uncivil again.
Doesn't take much insight to expect such a reaction.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Fri, 22 Apr 2011 17:21:52 +0200
From: Mart van de Wege <mvdwege@mail.com>
Subject: Re: grabbing a facebook group
Message-Id: <86zkni8g6n.fsf@gareth.avalon.lan>
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Fri, 22 Apr 2011 08:35:40 -0500 John Bokma <john@castleamber.com> wrote:
>
> JB> Tad McClellan <tadmc@seesig.invalid> writes:
>>> Uno <Uno@example.invalid> wrote:
>>>
>>>> I've decided that c.l.p.misc has problems I don't want
>>>> to be a part of.
>>>
>>> Yeah.
>>>
>>> A place that exposes poseurs makes the poseurs want to leave.
>>>
>>> That is the good kind of "problem"!
>
> JB> This attidude also pisses of other people as well. I don't know if you
> JB> have noticed it, but it's getting awfully quiet in here. I've been out
> JB> of this group because of this reason, the attidude of /you/ and some
> JB> others. Keep it going, and I am out again, and soon enough it will be
> JB> very quiet in here...
>
> Seconded. Tad is having a bad week or something, but Uri has been
> handing out the tough love for a while. Let's keep it civil, guys.
>
Bullshit.
Uno has had an explanation in friendly words that he totally
disregarded, and he started acting like a whiny bitch when called upon
it.
You can go all righteous about the people who finally lost their
patience, but I suggest you point your anger at the one that *made* them
lose their patience.
Sometimes someone is just plain *wrong*. Pussyfooting about will not
help, and if they persist in being wrong despite being told, they
deserve whatever they get.
And that's the last thing I'll say about this.
Mart
--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
------------------------------
Date: Fri, 22 Apr 2011 11:22:53 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: grabbing a facebook group
Message-Id: <877hamntlu.fsf@castleamber.com>
Mart van de Wege <mvdwege@mail.com> writes:
> Uno has had an explanation in friendly words that he totally
> disregarded, and he started acting like a whiny bitch when called upon
> it.
Then ignore Uno. One doesn't have to post. If Uno is a whiny bitch
there's no need to point it out. Uno is most likely aware of it, and why
waste time on stating the obvious. Oh, wait, it's a cheap and easy way
to score with some of the regulars here...
In the mean time there are hardly any on-topic serious posts here...
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 12:45:29 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: grabbing a facebook group
Message-Id: <m2hb9q44ly.fsf@sherm.shermpendley.com>
John Bokma <john@castleamber.com> writes:
> I don't know if you
> have noticed it, but it's getting awfully quiet in here.
That seems to be the case across the board though. I subscribe to RSS
feeds for 'objective-c' and 'perl' tags on Stack Overflow, and the first
routinely sees 3-4 times as many questions posted on a daily basis as
the second.
Perl is just as useful as it's always been, but the "buzz factor" that
made it the Hot Thing To Learn (tm) in the 90s is long gone - and the
trend-following crowd is gone with it. That decline has little (if any-
thing) to do with supposed "hostility" of the regulars in this group.
sherm--
--
Sherm Pendley
<http://camelbones.sourceforge.net>
Cocoa Developer
------------------------------
Date: Fri, 22 Apr 2011 12:47:19 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: grabbing a facebook group
Message-Id: <m2d3ke44iw.fsf@sherm.shermpendley.com>
Uno <Uno@example.invalid> writes:
> On 04/19/2011 01:43 PM, Sherm Pendley wrote:
>> Uno<Uno@example.invalid> writes:
>>
>>> $ cat fb1.pl
>>> #!/usr/bin/perl
>>> use strict;
>>>
>>> Are you stoned? Tad, if either being correct or promoting the
>>> discussion in c.l.p.misc is part of your job description, I think you
>>> need to resign.
>>
>> "Uno," get a grip. The space before the #! caused the OS to run the file
>> as a *shell script*. Once that happened, Perl wasn't involved at all.
>>
>> I'd like to help you, but you're about one ill-informed rant away from
>> being permanently ignored here.
>
> You know, sherm, I've decided that c.l.p.misc has problems I don't
> want to be a part of.
One of those problems being people who'd rather argue than learn...
sherm--
--
Sherm Pendley
<http://camelbones.sourceforge.net>
Cocoa Developer
------------------------------
Date: Fri, 22 Apr 2011 12:10:00 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: grabbing a facebook group
Message-Id: <slrnir3dae.5n0.tadmc@tadbox.sbcglobal.net>
John Bokma <john@castleamber.com> wrote:
> Then ignore Uno. One doesn't have to post. If Uno is a whiny bitch
> there's no need to point it out. Uno is most likely aware of it, and why
> waste time on stating the obvious. Oh, wait, it's a cheap and easy way
> to score with some of the regulars here...
If you don't like Tad's posts,
Then ignore Tad. One doesn't have to post. If Tad responds in-kind
to whiny bitches there's no need to point it out. Tad is most likely
aware of it, and why waste time on stating the obvious. Oh, wait,
all of that applys to Tad but not to John.
Why is that?
Because you are better than me?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Fri, 22 Apr 2011 21:32:38 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: grabbing a facebook group
Message-Id: <slrnir3lum.lok.hjp-usenet2@hrunkner.hjp.at>
On 2011-04-22 17:10, Tad McClellan <tadmc@seesig.invalid> wrote:
> John Bokma <john@castleamber.com> wrote:
>> Then ignore Uno. One doesn't have to post. If Uno is a whiny bitch
>> there's no need to point it out.
[...]
> If you don't like Tad's posts,
>
> Then ignore Tad. One doesn't have to post. If Tad responds in-kind
> to whiny bitches there's no need to point it out.
[...]
The difference is that I lose nothing if I put Uno in my killfile, but I
like to read your and Uri's postings - when they are about Perl. But all
too frequently your postings are not about Perl, but about the personal
shortcomings of some other poster. I urge you as respected regulars of
this group to set a good example and keep the last two points of the
Posting Guidelines (regularly posted by a certain Mr. McClellan - you
may know him) in mind:
| Count to ten before composing a followup when you are upset
| This is recommended in all Usenet newsgroups. Here in clpmisc, most
| flaming sub-threads are not about any feature of Perl at all! They
| are most often for what was seen as a breach of netiquette. If you
| have lurked for a bit, then you will know what is expected and won't
| make such posts in the first place.
|
| But if you get upset, wait a while before writing your followup. I
| recommend waiting at least 30 minutes.
|
| Count to ten after composing and before posting when you are upset
| After you have written your followup, wait *another* 30 minutes
| before committing yourself by posting it. You cannot take it back
| once it has been said.
hp
------------------------------
Date: Fri, 22 Apr 2011 14:43:07 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: grabbing a facebook group
Message-Id: <877hamjcms.fsf@castleamber.com>
"Peter J. Holzer" <hjp-usenet2@hjp.at> writes:
> On 2011-04-22 17:10, Tad McClellan <tadmc@seesig.invalid> wrote:
>> John Bokma <john@castleamber.com> wrote:
>>> Then ignore Uno. One doesn't have to post. If Uno is a whiny bitch
>>> there's no need to point it out.
> [...]
>> If you don't like Tad's posts,
>>
>> Then ignore Tad. One doesn't have to post. If Tad responds in-kind
>> to whiny bitches there's no need to point it out.
> [...]
>
> The difference is that I lose nothing if I put Uno in my killfile, but I
> like to read your and Uri's postings - when they are about Perl. But all
> too frequently your postings are not about Perl, but about the personal
> shortcomings of some other poster. I urge you as respected regulars of
> this group to set a good example and keep the last two points of the
> Posting Guidelines (regularly posted by a certain Mr. McClellan - you
> may know him) in mind:
Amen.
While I understand one can get frustrated with some "newbies" there is
no need to vent those frustrations in a public forum especially since it
has /zero effect/; tomorrow a new newbie will piss you off again.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 14:45:09 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: grabbing a facebook group
Message-Id: <8739lajcje.fsf@castleamber.com>
Sherm Pendley <sherm.pendley@gmail.com> writes:
> Perl is just as useful as it's always been, but the "buzz factor" that
> made it the Hot Thing To Learn (tm) in the 90s is long gone - and the
> trend-following crowd is gone with it. That decline has little (if any-
> thing) to do with supposed "hostility" of the regulars in this group.
The hostility (I see already 2 others agreeing with me) has made me
leave comp.lang.perl.misc several times. And I am sure I am not alone.
Yes, I agree that Perl is less popular than in the 90's. But I am
/convinced/ that some people have left this group /because/ of the
virtual dick swinging of some regulars here.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Fri, 22 Apr 2011 21:04:02 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Spreadsheet::WriteExcel, can't write to returned object?
Message-Id: <slrnir3k92.lok.hjp-usenet2@hrunkner.hjp.at>
On 2011-04-20 12:09, Willem <willem@toad.stack.nl> wrote:
> Jim Gibson wrote:
> ) The problem is that the top-level spreadsheet object ($workbook) as
> ) returned by new() is lexically-scoped to the create_excel_file
> ) subroutine and goes out of scope when the subroutine returns. While you
> ) are returning and saving the worksheet object, the spreadsheet file has
> ) probably been closed and written to disk at that point, so further
> ) writes do not get saved.
> )
> ) Solutions are to either 1) return the workbook object as well or 2)
> ) make the workbook object global (file scope).
>
> Or 3) stick a reference to the workbook object into the worksheet object,
> so that the reference sticks around until the worksheet goes out of scope.
That's a change in the spreadsheet object which should only be done by
the maintainer of that package, not by the user (staying out of the
living room and all that). Furthermore, it is likely to be an
incompatible change: Introducing a cyclic reference breaks garbage
collection, so all existing users of the package would have to
explicitely destroy the object.
hp
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 3362
***************************************