[29425] in Perl-Users-Digest
Perl-Users Digest, Issue: 669 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 21 21:10:21 2007
Date: Sat, 21 Jul 2007 18:09:12 -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 Sat, 21 Jul 2007 Volume: 11 Number: 669
Today's topics:
Re: ??YOUR VALUABLE OPINION COULD EARN YOU $3000 ?? <jurgenex@hotmail.com>
[OT] (was: Re: OK, so what's the different between OR a <rvtol+news@isolution.nl>
[OT] (was: Re: XML::Twig segfault on solaris) <rvtol+news@isolution.nl>
[OT] quoting UTF-8 in an iso-8859-1 context (was: Re: i <rvtol+news@isolution.nl>
Re: Connect DB2 environment setting problem <snhirsch@gmail.com>
Re: FAQ 4.45 How do I find the first array element for <tadmc@seesig.invalid>
Re: FAQ 4.45 How do I find the first array element for <brian.d.foy@gmail.com>
Re: FAQ 4.45 How do I find the first array element for <bik.mido@tiscalinet.it>
Re: FAQ 4.45 How do I find the first array element for anno4000@radom.zrz.tu-berlin.de
Re: FAQ 4.45 How do I find the first array element for <mjcarman@mchsi.com>
Re: lwp::simple get (why it would stop working along wi <hjp-usenet2@hjp.at>
Re: Math <tadmc@seesig.invalid>
Re: retrieving usenet messages III <zaxfuuq@invalid.net>
Re: retrieving usenet messages III <zaxfuuq@invalid.net>
Re: retrieving usenet messages III <zaxfuuq@invalid.net>
Re: retrieving usenet messages III <zaxfuuq@invalid.net>
wors on active perl but not on unix <nospam@home.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 21 Jul 2007 18:21:04 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: ??YOUR VALUABLE OPINION COULD EARN YOU $3000 ??
Message-Id: <k8soi.2569$jC4.1514@trndny09>
A Clark wrote:
> Do You Know Your VALUABLE OPINION Can Earn You Upto $3000 Per Month
And spamming does earn you a PLONK
------------------------------
Date: Sat, 21 Jul 2007 18:52:17 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: [OT] (was: Re: OK, so what's the different between OR and || in conditions?)
Message-Id: <f7tkt3.nc.1@news.isolution.nl>
detz schreef:
> anno:
>> Jürgen Exner:
>>> detz:
>>>> OK, so what's the different between OR and || in conditions?
>>>> I've never been given a clear answer to this.
>>>
>>> They have different priority. Details see "perldoc perlop".
>>
>> ...apart from the fact the Perl doesn't have an "OR" operator.
>
> There's always one smart-ass in the crowd..that's for nothing.
*PLONK*
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 21 Jul 2007 19:08:55 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: [OT] (was: Re: XML::Twig segfault on solaris)
Message-Id: <f7tlpa.1ac.1@news.isolution.nl>
Thomas Peter schreef:
> i redirected 'dprofpp -t's output to a file (120mb) and those messages
> appeared the last ~40k lines
Those millibits, they always make me smile.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 21 Jul 2007 18:28:03 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: [OT] quoting UTF-8 in an iso-8859-1 context (was: Re: interpolation)
Message-Id: <f7tje3.a0.1@news.isolution.nl>
Tad McClellan schreef:
> Content-Type: text/plain; charset=iso-8859-1
> [...]
> Whatâ?Ts wrong
Try LANG="" perldoc ...
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 21 Jul 2007 09:06:19 -0400
From: Steven Hirsch <snhirsch@gmail.com>
Subject: Re: Connect DB2 environment setting problem
Message-Id: <rJudnVOotfBWmT_bnZ2dnUVZ_vzinZ2d@giganews.com>
oillai@yahoo.com wrote:
> Hi,
>
> I write a perl program to connect to a remote DB2 database to generate
> daily report.
>
> I execute the program by command line is OK, but executed by crontab
> is failed.
>
> The program connection section:
> $uid="username";
> $pwd="password;
> $dsn = "dbi:DB2:DATABASE=WAREHOUS";
> $warehouse_dbh = DBI->connect($dsn, $uid, $pwd) || die "Connection
> failed with error: $DBI::errstr";
> ============================================================================
> The error message is following.
> Connection failed with error: Total Environment allocation failure!
> Did you set up your DB2 client environment?
You need to ensure that DB2INSTANCE, at a minimum, is set in the environment.
Depending upon your situation, other things may be required as well.
------------------------------
Date: Sat, 21 Jul 2007 15:52:15 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <slrnfa49k2.a54.tadmc@tadmc30.sbcglobal.net>
Michael Carman <mjcarman@mchsi.com> wrote:
> On 7/21/2007 5:00 AM, Michele Dondi wrote:
>> On 20 Jul 2007 23:50:25 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
>>>
>>> It can easily be combined with a check for uniqueness, which is sometimes
>>> an issue:
>>>
>>> my @l = qw( foo bar baz);
>>> ( my ( $first) = grep /ba/ => @l ) > 1 and warn "not unique\n";
>>> print "first: $first\n";
>>
>> for some reason I would have never thought of that, even though every single
>> bit of syntax and semantics is very clear and well known to me
>
> It's not clear to me.
You must be missing something then...
> Lists return their last element in scalar context, not
> their length.
There's one thing that you are missing.
There *is no such thing* as a list in scalar context.
When you see something like:
$foo = (1,2,3);
There *is no* list there. There is a comma operator there.
So lists do *not* return their last element in scalar context, because
they do not even exist in a scalar context.
> Is there an implicit anonymous array here?
No.
There is a "list assignment" in a scalar context here (inside
of the outer parenthesis).
So I think the other thing you are missing is the answer to:
What is the value of a list assignment in scalar context?
> Doc pointers appreciated.
From the "Assignment Operators" section in perlop.pod:
...a list assignment in list context produces the list of
lvalues assigned to, and a list assignment in scalar context returns
the number of elements produced by the expression on the right hand
side of the assignment.
So the list assignment returns the number of elements produced by
grep(), which is then compared to one.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 21 Jul 2007 11:38:50 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <210720071138506163%brian.d.foy@gmail.com>
In article <1184941331.498545.290230@57g2000hsv.googlegroups.com>,
MrL22 <mr.leishman@gmail.com> wrote:
> # Do this using GREP
>
> my @people = ('Jacob Smith', 'Michael Brown', 'Joshua Smith', 'Matthew
> Cope');
> @smiths = grep(/smith/i, @people);
The trick is to do it without doing extra work. Imagine a list with
thousands of elements. Do you really want to check every element, even
after you've found the first element?
That's why List::Util has first(). :)
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Sat, 21 Jul 2007 23:04:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <k3t4a3lon08rjqgpd7eoehu76rr4oqb80q@4ax.com>
On Sat, 21 Jul 2007 14:43:28 GMT, Michael Carman <mjcarman@mchsi.com>
wrote:
>It's not clear to me. Lists return their last element in scalar context, not
>their length. Is there an implicit anonymous array here? Doc pointers appreciated.
No, but *list assignment* returns the size of its *rhs*, there's been
a long, pitaful (but also interesting in some deep reply) thread about
this recently.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 22 Jul 2007 00:30:23 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <5gfmovF3gdm2eU1@mid.dfncis.de>
brian d foy <brian.d.foy@gmail.com> wrote in comp.lang.perl.misc:
> In article <1184941331.498545.290230@57g2000hsv.googlegroups.com>,
> MrL22 <mr.leishman@gmail.com> wrote:
>
> > # Do this using GREP
> >
> > my @people = ('Jacob Smith', 'Michael Brown', 'Joshua Smith', 'Matthew
> > Cope');
> > @smiths = grep(/smith/i, @people);
>
> The trick is to do it without doing extra work. Imagine a list with
> thousands of elements. Do you really want to check every element, even
> after you've found the first element?
>
> That's why List::Util has first(). :)
Unfortunately List::Util::first is slightly broken. I returns an
undefined value when there is no first element, either because the
condition never matched or because the list to search is empty in
the first place. It should return empty in this case. As it is,
if the condition can match an undefined value there is no way to
tell if it did that or if it never matched.
Anno
------------------------------
Date: Sat, 21 Jul 2007 14:43:28 GMT
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <kYooi.34567$Fc.4656@attbi_s21>
On 7/21/2007 5:00 AM, Michele Dondi wrote:
> On 20 Jul 2007 23:50:25 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
>>
>> It can easily be combined with a check for uniqueness, which is sometimes
>> an issue:
>>
>> my @l = qw( foo bar baz);
>> ( my ( $first) = grep /ba/ => @l ) > 1 and warn "not unique\n";
>> print "first: $first\n";
>
> for some reason I would have never thought of that, even though every single
> bit of syntax and semantics is very clear and well known to me
It's not clear to me. Lists return their last element in scalar context, not
their length. Is there an implicit anonymous array here? Doc pointers appreciated.
-mjc
------------------------------
Date: Sat, 21 Jul 2007 13:26:05 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: lwp::simple get (why it would stop working along with wget when fetch still works)
Message-Id: <slrnfa3rad.rl8.hjp-usenet2@zeno.hjp.at>
On 2007-07-18 02:17, rockerd@gmail.com <rockerd@gmail.com> wrote:
> Something recently changed on a site that I was fetching and parsing
> from with lwp::simple.
> Here is the thing: For the longest time I was using get() to grab a
> http: site and store it in a scalar which I parsed later. Suddenly I
> get an empty but defined scalar with: $html = get($url);
Use LWP::Simple only if you are absolutely sure that you never need the
return code or headers. LWP::UserAgent is almost always the better
choice, especially if you have to handle errors or strange behaviour.
> More: when I use fetch on a freebsd system it pulls the page to text
> without any problems but when I use wget on a linux system I get a
> blank file. Everything used to work. I tried changing my user-agent
> headers and have had no luck.
Is "a linux system" the system where the script normally runs and "a
freebsd system" a different system? It might be that the owner of the
site noticed that you are automatically retrieving data and blocking
your IP address.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Sat, 21 Jul 2007 15:52:16 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Math
Message-Id: <slrnfa4a7i.a54.tadmc@tadmc30.sbcglobal.net>
Wade Ward <zaxfuuq@invalid.net> wrote:
> It was an intemperate response rooted in frustration.
Those can have long-lasting consequences, so you should attempt
to avoid them whenever possible.
Have you seen the Posting Guidelines that are posted here frequently?
Be extra cautious when you get upset
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.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 21 Jul 2007 18:43:46 -0700
From: "merl the perl" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <oe-dnYHq--WvET_bnZ2dnUVZ_ualnZ2d@comcast.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:pai3a3dv0qveuricknv402954amhnbqcsj@4ax.com...
> On Fri, 20 Jul 2007 22:53:50 -0700, "merl the perl"
> <zaxfuuq@invalid.net> wrote:
>
>>> Yeah, like Merril Strip, ain't it? ;-p
>>That's the final insult with my name. The only Merrill out there is Meryl
>
> With a winking eye and a tongue like that, it can't be an insult.
No, I didn't mean you insulting, I meant the name insults. Kind of like a
boy name Sue, if you know your Johnny Cash.
--
merl
------------------------------
Date: Sat, 21 Jul 2007 18:55:33 -0700
From: "merl the perl" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <HKWdndbhH81oEz_bnZ2dnUVZ_oytnZ2d@comcast.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:pji3a31spsd57stb9ebcat35ptukpp8nfv@4ax.com...
> On Fri, 20 Jul 2007 22:50:45 -0700, "merl the perl"
> <zaxfuuq@invalid.net> wrote:
> I think so too. Which version of perl are you using? 5.8.8 here -AS
> build 820- and as I wrote D::P v. 1.16 is available from AS's
> repository.
I think I'm using 5.6 and that I have 5.8 on disc; just need to find it.
I'll update and see if I get the Date::Parse module.
> Well, do you accept a bet? Would you bet that mine, modified as not to
> use Date::Parse WILL RUN as well?
> Mine doesn't use newnews() either. Whether you use my simple minded
I think you want "simplistic" or simply "simple." Simple-minded is
pejorative.
> Why? Can't you use Solaris' perl? Which, for what I've heard, should
> come preinstalled...
That's the point. Perl's a little bit of a platypus on windows. With
Solaris, I'll get C99, Fortran2003, and perl from the get-go. I'm not
moving forward very quickly with the install because I've never run 2 OS's
on the same machine.
--
merl
------------------------------
Date: Sat, 21 Jul 2007 19:04:53 -0700
From: "merl the perl" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <0Mmdneoh48m4DD_bnZ2dnUVZ_qiinZ2d@comcast.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:l5l3a3l6fjkupfp3e2uuo55mn6kn3lav3f@4ax.com...
> On Sat, 21 Jul 2007 00:03:33 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> wrote:
>
>>> Oh no, again! Did you try by any chance try using my "version" of the
>>> script, or the much more complete program a link to which was posted
>>> by another one of the regulars here?
>>I certainly don't recall seeing such a link.
>
> Funny, I can remember this quite easily and could find it easily as
> well with GG. In <news:f6o29i.1gk.1@news.isolution.nl> "Dr.Ruud"
> <rvtol+news@isolution.nl> wrote:
>
> : > it turned our that
> : > the command corresponding to the newnews method was not supported at
> : > either of the news servers I have access to.
> :
> : That was actually one of the reasons why I mentioned:
> : http://www.xs4all.nl/~rvtol/perl/xover_clpm.pl
That's a good reference for me. There's still a lot of the syntax I don't
get but this is more immdeiate than the other program. Thanks.
--
merl
------------------------------
Date: Sat, 21 Jul 2007 19:34:47 -0700
From: "merl the perl" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <5YGdnc1Mcdy6BT_bnZ2dnUVZ_u2mnZ2d@comcast.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:pji3a31spsd57stb9ebcat35ptukpp8nfv@4ax.com...
> On Fri, 20 Jul 2007 22:50:45 -0700, "merl the perl"
> <zaxfuuq@invalid.net> wrote:
>
>>> ppm install Date::Parse
>>Installing package 'Date-Parse'...
>>Error installing package 'Date-Parse': Could not locate a PPD file for
>>package Date-Parse
>>It looks like I'll be wanting to do some updating.
>
> I think so too. Which version of perl are you using? 5.8.8 here -AS
> build 820- and as I wrote D::P v. 1.16 is available from AS's
> repository.
I just installed 5.8 build 820, then installed the date::parse module, and
have success:-)
# abridged output:
Path:
border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 21 Jul 2007 18:05:09 -0500
From: "merl the perl" <zaxfuuq@invalid.net>
Newsgroups: comp.lang.perl.misc
References: <AcednX7A-f0vwADbnZ2dnUVZ_jWdnZ2d@comcast.com>
<ihou93ptmuu3m4r6s1afkoa4c7i3s2sq4g@4ax.com>
<uPKdnahMjMU4GDzbnZ2dnUVZ_r-vnZ2d@comcast.com>
<l5l3a3l6fjkupfp3e2uuo55mn6kn3lav3f@4ax.com>
Subject: Re: retrieving usenet messages III
Date: Sat, 21 Jul 2007 19:04:53 -0700
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-RFC2646: Format=Flowed; Original
Message-ID: <0Mmdneoh48m4DD_bnZ2dnUVZ_qiinZ2d@comcast.com>
Lines: 27
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 24.11.39.211
X-Trace:
sv3-F79PBDzQWuQHPyBh+IF/YajwSf6RK3rzQgUonxS+8hRfwcXQJWBb3OhDYgnT+i7JVibZGmfGbTMM8Np!SFvU7ecH7JtJWyBN1t8XgpBy5W9FcNNW3HkDBxTh1ag+gKzxy9iJVpx4zg+61hGqoiTFxRgedNNX!MsryDESZ3/inlrVdnDYzxRxt7yXB
X-Complaints-To: abuse@comcast.net
X-DMCA-Complaints-To: dmca@comcast.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint
properly
X-Postfilter: 1.3.35
Bytes: 2396
Xref: number1.nntp.dca.giganews.com comp.lang.perl.misc:634273
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:l5l3a3l6fjkupfp3e2uuo55mn6kn3lav3f@4ax.com...
> On Sat, 21 Jul 2007 00:03:33 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> wrote:
>
>>> Oh no, again! Did you try by any chance try using my "version" of the
>>> script, or the much more complete program a link to which was posted
>>> by another one of the regulars here?
>>I certainly don't recall seeing such a link.
>
> Funny, I can remember this quite easily and could find it easily as
> well with GG. In <news:f6o29i.1gk.1@news.isolution.nl> "Dr.Ruud"
> <rvtol+news@isolution.nl> wrote:
>
> : > it turned our that
> : > the command corresponding to the newnews method was not supported at
> : > either of the news servers I have access to.
> :
> : That was actually one of the reasons why I mentioned:
> : http://www.xs4all.nl/~rvtol/perl/xover_clpm.pl
That's a good reference for me. There's still a lot of the syntax I don't
get but this is more immdeiate than the other program. Thanks.
--
merl
------------------------------
Date: Sat, 21 Jul 2007 12:44:55 GMT
From: "Nospam" <nospam@home.com>
Subject: wors on active perl but not on unix
Message-Id: <bdnoi.504$mZ5.411@newsfe6-win.ntli.net>
I am wondering what would cause a code that works in activeperl to not work
in nix particularly to the quote character i.e %22 same code in active perl
get("..%22...%22"); works fine but run on a server gets nothing, is there a
difference in the way perl on a unix server would interprete the quote
character i.e %22 as opposed to active perl on a windows environment?
------------------------------
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 669
**************************************