[28806] in Perl-Users-Digest
Perl-Users Digest, Issue: 50 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 19 09:05:48 2007
Date: Fri, 19 Jan 2007 06:05:08 -0800 (PST)
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, 19 Jan 2007 Volume: 11 Number: 50
Today's topics:
Re: convert Vbscript to Perl code <novafyre@hotmail.com>
Re: How to decode javascript encodeURI / encodeURICompo <Cloink_Friggson@ntlworld.com>
Re: How to decode javascript encodeURI / encodeURICompo <Cloink_Friggson@ntlworld.com>
Re: How to decode javascript encodeURI / encodeURICompo <thomas.wasell@screw.spammers.invalid>
Re: How to decode javascript encodeURI / encodeURICompo <mritty@gmail.com>
Re: How to decode javascript encodeURI / encodeURICompo <1usa@llenroc.ude.invalid>
How to get the return codes for shell commands <vaibhav.aparimit@gmail.com>
Re: How to get the return codes for shell commands <vaibhav.aparimit@gmail.com>
Re: How to get the return codes for shell commands <mritty@gmail.com>
Re: How to get the return codes for shell commands <mritty@gmail.com>
Re: I/O open() <novafyre@hotmail.com>
Re: Indirect function call via Name anno4000@radom.zrz.tu-berlin.de
Re: need help with the tr and s/// <bik.mido@tiscalinet.it>
Re: Perl + Java corrieknor@hotmail.com
Re: Perl + Java <bik.mido@tiscalinet.it>
Perl CGI or Something Else CGI? <rg.bacs@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Jan 2007 03:25:10 -0700
From: Mark Donovan <novafyre@hotmail.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <C1D5EA96.9577%novafyre@hotmail.com>
Wow! That was impressive! Someone whose immense intellectual prowess can be
summarized with a single eloquent phrase,
"HALAGAGALAGAGALALAGAGAGAGAALLLAA".
Vronans and Tony, I agree with you. There is a problem here. Abusive, rude
and offensive remarks are condoned with more rudeness, specious arguments,
and eloquent statements such as "HALAGAGALAGAGALALAGAGAGAGAALLLAA".
Mr. Bokma has set a high standard that explained the problem with Tony's
e-mail address respectfully and without sarcasm and abuse. Isn't it amazing
what a little common courtesy can achieve. Thank you, Mr. Bokma.
Regards,
Mark Donovan
>>>>>> "tp" == tony p <nuke@all.spam> writes:
>
> tp> Uri Guttman wrote:
>>>
>>> anonymity is another way to make yourself ignored. cowards have no
>>> rights to attack others.
>
> tp> If you refer to the fact I choose not to display my email address, then
> tp> that is anyone's rught. With email harvesters and the likes, it should
> tp> not be surprising. If you wish to email me, just ask and I'll post
> tp> munged version of my email.
>
> tp> I do, however, use my real name, so I'm not truly anonymous.
>
>>> this is not a court of law or where you need
>>> to be in the witless (sic) protection program. and the rule of not
>>> helping with perl also stands. have you helped an old lady with her
>>> perl
>>> today?
>
> tp> A rule you made up, and you are judging people on based on your own
> tp> ignorance. No one owns a group. Get over it.
>
> tp> It's clear to me you'll use any rational to form your arguments rather
> tp> then actually answering the original question about the posting conduct
> tp> of another poster. Questions of that type have always been allowed,
> tp> regardless of subject.
>
> HALAGAGALAGAGALALAGAGAGAGAALLLAA
>
> uri
> --
> Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
> Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 19 Jan 2007 05:02:21 -0800
From: "Cloink" <Cloink_Friggson@ntlworld.com>
Subject: Re: How to decode javascript encodeURI / encodeURIComponent ?
Message-Id: <1169211741.678652.189990@l53g2000cwa.googlegroups.com>
Look Brian clever clogs McCauley, I spent hours trawling the web, don't
come your "You haven't tried hard enough," sneering down your nose at
me. The FAQ. THE faq. Which one? I frequently ask myself "Why o
why?" but I don't think you meant that FAQ. I am encoding using
standardised javascript functions. I searched on those functions. I
found nothing useful. I don't enjoy wasting my time, and I certainly
ain't taking any gip off you.
Do you really need a link to the ECMAscript v3 definition of
encodeURI/encodeURIComponent/decodeblahblah when you can look it up in
the Rhino book? Sorry if I used the wrong terminolgy when I said W3C,
I'm not a geek.
Nevertheless, I'm sure many people have sat round a table and decided
that the best way to encode a URL (sorry, URI, mustn't get the jargon
wrong) is by the method that encodeURI/Component does it. So if that's
the way that javascript encodes it, bearing in mind that javascript
communicates http requests with Perl a zillion times a day on the
tinterweb, how come I'm finding it so hard to find a reference to a
Perl function that decodes via the reverse algorithm?
Talking of algorithms, the only almost-useful bit of your reply doesn't
actually explain the algorithm by which one reaches xC3xA9 from u00E9.
Which would've been nice.
Thanks for your time.
Brian McCauley wrote:
> On Jan 18, 1:33 pm, "Cloink" <Cloink_Frigg...@ntlworld.com> wrote:
> > Simply: How ?
>
> This is (almost) FAQ: "How do I decode or create those %-encodings on
> the web?"
>
> > I can't believe no-one's already done it, but I can't find any exact
> > mention of it on the tinterweb.
>
> But there is (almost) an exact mention in the FAQ.
>
> > Closest I got was someone suggesting a custom javascript function to
> > encode a URI in the style that Perl expects - no way Jos=E9 - what's the
> > point in the W3C standardising this stuff for all our benefits if we go
> > and write custom functions instead.
>
> If you are going to mention a standard it's couresy to provide a link.
>
> > So come on - I need a Perl function to decode a URL that has been
> > encoded with a javascript encodeURI() or encodeURIComponent() call.
> >
> > Alternatively, I can write the Perl function myself if someone can
> > explain how the encoding works in the js funcs?
>
> Hang on, didn't you just say there was a W3C standard?
>
> > e.g.
> > =E9 (e-acute) is encoded via encodeURIComponent to %C3%A9, which doesn't
> > obviously tie in with the Unicode specification 00E9. But the js
> > references I've read claim that it is Unicode compliant, so what am I
> > missing?
>
> Unicode gives each character a "code point". That is a pure number. The
> way that number is encoded as a byte sequence is another thing. Unicode
> defines a number of such encodings. The way U+E9 is represented in the
> most common Unicode encoding (utf8) is the byte seqence 0xC3,0xA9. So
> it looks like encodeURIComponent is encoding the utf8 byte seqence.
------------------------------
Date: 19 Jan 2007 05:18:05 -0800
From: "Cloink" <Cloink_Friggson@ntlworld.com>
Subject: Re: How to decode javascript encodeURI / encodeURIComponent ?
Message-Id: <1169212685.254223.221110@m58g2000cwm.googlegroups.com>
Thanks Reinhard, but does that definitely decode a URL encoded with
JavaScript's encodeURI/ encodeURIComponent ? The copyright says 1997
and I don't think the js functions have been around that long. Plus,
I've already parsed my query string into key/value pairs, I just need
to decode the %xx[%xx[%xx]] characters either into their unicode uxxxx
representations or genuine characters.
Reinhard Pagitsch wrote:
> Cloink wrote:
> > Simply: How ?
> >
> > I can't believe no-one's already done it, but I can't find any exact
> > mention of it on the tinterweb.
> >
> > Closest I got was someone suggesting a custom javascript function to
> > encode a URI in the style that Perl expects - no way Jos=E9 - what's the
> > point in the W3C standardising this stuff for all our benefits if we go
> > and write custom functions instead.
> >
> > So come on - I need a Perl function to decode a URL that has been
> > encoded with a javascript encodeURI() or encodeURIComponent() call.
> >
> > Alternatively, I can write the Perl function myself if someone can
> > explain how the encoding works in the js funcs?
> >
> > e.g.
> > =E9 (e-acute) is encoded via encodeURIComponent to %C3%A9, which doesn't
> > obviously tie in with the Unicode specification 00E9. But the js
> > references I've read claim that it is Unicode compliant, so what am I
> > missing?
> >
> > Cheers all.
> > Cloink
> >
>
> Maybe the following modules will help you:
> CGI::Deurl and CGI::Enurl
>=20
> regards
> Reinhard
>=20
> --=20
> PM Mails an rpirpag <at> gmx dot at
------------------------------
Date: Fri, 19 Jan 2007 13:20:51 GMT
From: Thomas Wasell <thomas.wasell@screw.spammers.invalid>
Subject: Re: How to decode javascript encodeURI / encodeURIComponent ?
Message-Id: <MPG.201ae41c325155c989688@news1.comhem.se>
In article <1169211741.678652.189990@l53g2000cwa.googlegroups.com>,
Cloink_Friggson@ntlworld.com wrote:
>Look Brian clever clogs McCauley, I spent hours trawling the web, don't
>come your "You haven't tried hard enough," sneering down your nose at
>me. The FAQ. THE faq. Which one? I frequently ask myself "Why o
>why?" but I don't think you meant that FAQ. [...]
Did you try
http://www.google.com/search?q=perl+FAQ
--
"Think about it. With discoveries like mine,
most of you would probably just explode."
-- JSH debating the finer points of
mathematics
------------------------------
Date: 19 Jan 2007 05:30:45 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How to decode javascript encodeURI / encodeURIComponent ?
Message-Id: <1169213445.786748.161890@v45g2000cwv.googlegroups.com>
Cloink wrote:
> Look Brian clever clogs McCauley, I spent hours trawling the web, don't
> come your "You haven't tried hard enough,"
Trying long is no where near the same as trying hard.
> sneering down your nose at
> me. The FAQ. THE faq. Which one?
Are you really that dense? You posted a question to a *Perl*
newsgroup, and someone tells you to look at the FAQ, and you can't
figure out that means "The Perl FAQ"? Cripes, no wonder you're having
so much difficulty.
Paul Lalli
------------------------------
Date: Fri, 19 Jan 2007 13:44:45 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to decode javascript encodeURI / encodeURIComponent ?
Message-Id: <Xns98BD58E356185asu1cornelledu@127.0.0.1>
"Cloink" <Cloink_Friggson@ntlworld.com> wrote in
news:1169211741.678652.189990@l53g2000cwa.googlegroups.com:
> I'm not a geek.
...
> javascript communicates http requests with Perl a zillion times a day
> on the tinterweb,
http://www.urbandictionary.com/define.php?term=Tinterweb
The tinterweb is a slang word for the internet. It it used by those people
who are actually geeks and spend all their time on the internet but who
want to look cool and non-geeky.
'nuff said.
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 19 Jan 2007 04:24:33 -0800
From: "vabby" <vaibhav.aparimit@gmail.com>
Subject: How to get the return codes for shell commands
Message-Id: <1169209473.220110.57530@l53g2000cwa.googlegroups.com>
Hi
I am writing a perl script in which I am using some commnds like, mv,
rcp, rsync, rm etc. How can I get the return codes of these commands.
I read somewhere that the following will work.
my $result = 'mv abc abc.cfg';
But on actually trying this doesnot work. so I used the following
my $result =system('mv abc abc.cfg');
However for commands like rsync this is givin me erroneous results.
Tx
Vaibhav
------------------------------
Date: 19 Jan 2007 04:28:47 -0800
From: "vabby" <vaibhav.aparimit@gmail.com>
Subject: Re: How to get the return codes for shell commands
Message-Id: <1169209727.393306.118630@a75g2000cwd.googlegroups.com>
Also for most of teh common commands the result code is 0. Is it also
true for other commands like rsync etc.
------------------------------
Date: 19 Jan 2007 05:11:47 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How to get the return codes for shell commands
Message-Id: <1169212307.033749.225700@51g2000cwl.googlegroups.com>
vabby wrote:
> I am writing a perl script in which I am using some commnds like, mv,
> rcp, rsync, rm etc. How can I get the return codes of these commands.
>
> I read somewhere that the following will work.
> my $result = 'mv abc abc.cfg';
Unlikely. Probably what you read was that the following will work:
my $result = `mv abc abc.cfg`;
That is, using back ticks, not single quotes. This is erroneous,
however. Backticks return the output of a command, not its exit
status.
> But on actually trying this doesnot work. so I used the following
>
> my $result =system('mv abc abc.cfg');
>
> However for commands like rsync this is givin me erroneous results.
What exactly is erroneous about the results? Have you read the
documentation for the function you're using?
perldoc -f system
will tell you exactly what system() is returning, and how to get out of
that the actual exit status.
Paul Lalli
------------------------------
Date: 19 Jan 2007 05:15:45 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How to get the return codes for shell commands
Message-Id: <1169212545.302416.213400@m58g2000cwm.googlegroups.com>
vabby wrote:
> Also for most of teh common commands the result code is 0. Is it also
> true for other commands like rsync etc.
Yes, and? What is making you believe the result code should *not* be
0? The vast majority of applications return 0 to indicate success.
Paul Lalli
------------------------------
Date: Fri, 19 Jan 2007 06:51:06 -0700
From: Mark Donovan <novafyre@hotmail.com>
Subject: Re: I/O open()
Message-Id: <C1D61ADA.95A2%novafyre@hotmail.com>
On 1/19/07 00:17, "mmccaws2" <mmccaws@comcast.net> wrote:
>
> So far each package I've installed related to this required force
> install. I suspect that there is something wrong done early on when I
> was having difficulties.
>
> I installed Net::Sockets and Net::DNS.
>
> When I tried to run the example test script I got the following
> errors.
>
> Can't locate Net/IP.pm in @INC (@INC contains:
> /System/Library/Perl/5.8.6/darwin-thread-multi-2level
> /System/Library/Perl/5.8.6
> /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6
> /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
> /Network/Library/Perl/5.8.6 /Network/Library/Perl
> /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
> /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at
> /Library/Perl/5.8.6/darwin-thread-multi-2level/Net/DNS/Resolver/Base.pm
> line 24.
>
> [snip]
>
> Could it be my cpan settings? How do I check that.
>
Your @INC list is the same as mine. That doesn't seem to be a problem.
Simply 'print @INC;' to see your settings.
I have IP.pm at /Library/Perl/5.8.6/Net/IP.pm
Is IP.pm on your system? "Can't locate Net/IP.pm in @INC" says IP.pm is not
where it should be.
IP.pm comes from the Net::IP module. The current version is v1.25.
Net::IP needs the Math::BigInt module.
--
Mark
------------------------------
Date: 19 Jan 2007 08:30:17 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Indirect function call via Name
Message-Id: <51bdspF1j2qiaU1@mid.dfncis.de>
Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
[...]
> you have? unless you are using AUTOLOAD which is only for methods (and
> methods can be called symbolically anyhow), you know your codebase.
AUTOLOAD is only for methods? It works for all subs, and I don't see
how defining a method at run-time is fundamentally different from
defining a non-method.
Anno
------------------------------
Date: Fri, 19 Jan 2007 11:08:21 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: need help with the tr and s///
Message-Id: <8951r2ht6elgckh8dbil0d3j8hujoti97j@4ax.com>
On Thu, 18 Jan 2007 16:36:58 -0700, Mark Donovan
<novafyre@hotmail.com> wrote:
>someone to examine the intermediate results. Moreover, my answer included a
>method that avoided the extra steps. But for my purpose of illustrating the
>method, your assertion is simply wrong.
To quote:
: Here's the same result with two statements that run about 15 percent faster.
:
: ($len = $s1) =~ s/.*?(0*)\z/length $1/e;
: $s2 =~ s/(.*?)0*\z/$1 . '0' x $len/e;
That is, your method that "avoided the extra steps" still *had* the
extra steps of (i) taking a string length and (ii) using it to rebuild
the original string, whereas the latter would do in the first place.
IMNSHO this is neither logical nor convenient. The point I'm trying to
make, but I won't try any harder than this, is that one thing is to
break say a single statement into several ones with assignments to
temporary variables -for illustrative purposes- and a whole another
thing is to arbitrarily insert extra steps that are involutive, i.e.
consist of mappings that yield identity when composed each other.
Basically you're building the $pad string like thus:
$s1 =~ m/(0*)\z/;
my $len = length $1;
my $pad = '0' x $len;
But I see no point in doing so when $pad eq $1 in the first place.
>You should understand that placing the word *please* in front of a sentence
>does not make a rude and irrelevant demand into a polite request. You are
I wrote "*please*" because it really bothers me to see top-posted
stuff, and it tends to make my life harder when replying further
because it increases the probability of requiring me to do editing
acrobatics, and there's a general consensus here that proper quoting
is preferred. Glad to notice you prefer to intentionally bother me,
and others here, for no particular good reason...
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: 19 Jan 2007 00:05:49 -0800
From: corrieknor@hotmail.com
Subject: Re: Perl + Java
Message-Id: <1169193949.283202.168130@m58g2000cwm.googlegroups.com>
Michele Dondi wrote:
> On 18 Jan 2007 06:26:40 -0800, corrieknor@hotmail.com wrote:
>
> >Also: The Perl script should parse a paramter to the Java application
>
> What does this mean?
>
>
> Michele
> --
The perl script should call the java appl. with a parameter. This
parameter is used in the Java appl. to look something up and return
this to the perl scripy
------------------------------
Date: Fri, 19 Jan 2007 11:13:44 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl + Java
Message-Id: <t761r2p1mgeaf00c3almbc1febo1ag98as@4ax.com>
On 19 Jan 2007 00:05:49 -0800, corrieknor@hotmail.com wrote:
>> >Also: The Perl script should parse a paramter to the Java application
>>
>> What does this mean?
[snip]
>The perl script should call the java appl. with a parameter. This
>parameter is used in the Java appl. to look something up and return
>this to the perl scripy
my $exit_status = system 'java_appl', $parameter;
But if with "return" you mean to "print something on STDOUT", then
you'd better use backticks a.k.a. qx// and documented in perldoc
perlop, or a piped open(), documented in perldoc -f open.
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: 19 Jan 2007 05:47:02 -0800
From: "Rg" <rg.bacs@gmail.com>
Subject: Perl CGI or Something Else CGI?
Message-Id: <1169214421.662377.24050@l53g2000cwa.googlegroups.com>
Hello everyone,
I am writing drafts for an online system that must be accessible via
Web and must make use of some DBMS (probably MySQL). I am planning on
using Perl CGI, but I can't really make up my mind about that decision.
The one fact that prevents me from starting to write Perl CGI right
away is efficency. It worries me that every page hit should have the
Perl interpreter instantiated and then have it logged into the DBMS.
Instead, I'd like something that would stay memory-resident and already
logged into the DBMS. I thought then of using pure C CGI and linking
page requests with a resident process. But, of course, I can't really
make up my mind about that decision...
So, here's the question: should I actually worry about starting up the
Perl interpreter and then logging into the DBMS at the expense of
efficiency? Does that really happen or Perl CGI works in some other way
that I'm just missing here? And, finally, does it pay to use pure C CGI
or PHP instead of Perl CGI?
Rg
------------------------------
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 50
*************************************