[26683] in Perl-Users-Digest
Perl-Users Digest, Issue: 8790 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 23 11:05:32 2005
Date: Fri, 23 Dec 2005 08:05:04 -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, 23 Dec 2005 Volume: 10 Number: 8790
Today's topics:
Re: Dynamic directory handles? <whoever@whereever.com>
Re: Dynamic directory handles? <whoever@whereever.com>
Re: Exiting without printing <NoSPam@NoSpam.com>
Re: My Regexp XML Parser -> Structured Perl Data, Cut <tadmc@augustmail.com>
Re: perl, v5.8.7 Windows 2003 PPM 3.3 <matthew.garrish@sympatico.ca>
protect perl script from spammers <notelling@anyone.com>
Re: protect perl script from spammers <noreply@gunnar.cc>
Re: protect perl script from spammers <NoSPam@NoSpam.com>
Re: protect perl script from spammers <jurgenex@hotmail.com>
Re: protect perl script from spammers <noreply@gunnar.cc>
Re: protect perl script from spammers <NoSPam@NoSpam.com>
Re: protect perl script from spammers <matthew.garrish@sympatico.ca>
Re: quotes (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 23 Dec 2005 11:09:37 -0000
From: "IanW" <whoever@whereever.com>
Subject: Re: Dynamic directory handles?
Message-Id: <dogltg$rmq$1@blackmamba.itd.rl.ac.uk>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrndqmkop.85q.tadmc@magna.augustmail.com...
> IanW <whoever@whereever.com> wrote:
>> I was thinking of sth along those lines
>
> s/sth/something/;
>
> Please don't use "cutsie" spellings in Usenet posts.
>
> It is inconsiderate of folks whose first language is not English.
As is using the word "cutsie", which I always thought was spelt "cutesy",
and since such folks may have to use a dictionary for a word of less
frequent usage like that, it would help them if you spell it correctly ;-)
>>> next if $fl eq '.' or $fl eq '..';
>>
>> is there any reason for doing it that way over my original line using a
>> regexp?
>
>
> Yes, the same reason that you should be applying to all the code
> you write: it is easier to read and understand.
I find a short regexp like that just as easy to understand as the non-regexp
version
> Optimize for labor, optimize for labor, optimize for labor.
>
>
>> is it a performance thing?
>
>
> Yes, your maintenance programmer will perform better.
hehe, that's me in this case
Ian
------------------------------
Date: Fri, 23 Dec 2005 12:19:56 -0000
From: "IanW" <whoever@whereever.com>
Subject: Re: Dynamic directory handles?
Message-Id: <dogq1b$t54$1@blackmamba.itd.rl.ac.uk>
"Glenn Jackman" <xx087@freenet.carleton.ca> wrote in message
news:slrndqlrjc.pbr.xx087@smeagol.ncf.ca...
> At 2005-12-22 12:32PM, IanW <whoever@whereever.com> wrote:
>> "Tad McClellan" <tadmc@augustmail.com> wrote in message
>> news:slrndqlck1.71n.tadmc@magna.augustmail.com...
>>
>> >> #use strict;
>> >
>> > You lose all of the benefits of that statement when you comment it out!
>>
>> yes, I know - I had it commented out to double check that the script
>> worked
>> without use strict.
>
> If your code runs with strict, it will certainly run without.
yes, when I originally wrote the script in a test file I forgot to put the
use strict in it
> [...]
>> > my($cdir) = shift || '';
>>
>> that's a neat way of avoiding getting a warning (yes, I did have use
>> warnings in there for a while :-).. is there any particular reason you
>> use
>> single quotes there instead of double quotes? I tend to use "" for
>> pretty
>> much everything. Also, I don't ever seem to use "||" - "or" would work
>> as
>> well in that scenario wouldn't it?
>
> I use single quotes to remind myself (and perl) that I have a literal
> string that needs no interpolation.
that sounds like another good habit to adopt..
> '||' and 'or' have different operator precedences. Note also that '||'
> has higher precendence than '=' which is higher than 'or'. So,
> my($cdir) = shift || '';
> is the same as
> my($cdir) = (shift || '');
>
> Test:
> $x = undef || 'alternate';
> print '$x is ', (defined $x ? "'$x'" : 'undefined!'), "\n";
>
> Conversly,
> my($cdir) = shift or '';
> is the same as
> ( my($cdir) = shift ) or '';
> and thus $cdir may still be undefined.
>
> Test:
> $y = undef or 'alternate';
> print '$y is ', (defined $y ? "'$y'" : 'undefined!'), "\n";
>
> Another way of proving default values is the '||=' operator, as in:
> my $cdir = shift;
> $cdir ||= ''; # set cdir to the empty string if previously undefined.
OK, got that.
Thanks
Ian
------------------------------
Date: Fri, 23 Dec 2005 09:29:12 -0500
From: "Daniel Kaplan" <NoSPam@NoSpam.com>
Subject: Re: Exiting without printing
Message-Id: <1135348151.246028@nntp.acecape.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:dogk3d$r1c$1@mamenchi.zrz.TU-Berlin.DE...
> Are you saying you are testing a cron job by running it as a CGI script?
> That is wrong. The universal testing environment is a shell, and all
> scripts (CGI, cron jobs, anything) should first be debugged in a a shell.
> Then test it in the environment it is supposed to run in (don't forget
> that step).
Sadly my startup is severly limited funding wise. My server is housed with
a large company, and I pay them to do all the server admin stuff. Which
leaves me to whatever "I" can. So I don't do everythign right, but I
eventually get there. Kinda like taking your right hand, going up around
the top of your head and grabbing your left ear. It's round about, and
slow, and I try to learn as much as I can on the way there.
One day I'll be able to just reach up with my left hand, and grab my left
ear ;-)
Thanks again to all those that helped.
Daniel
------------------------------
Date: Fri, 23 Dec 2005 06:53:28 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: My Regexp XML Parser -> Structured Perl Data, Cut & Paste Version, No Module's (Vol I)
Message-Id: <slrndqnsq8.9gf.tadmc@magna.augustmail.com>
robic0 <> wrote:
> Comments have an issue with enclosed "<" or ">" in this
> version, other than that they will process normally.
> Its a regex issue (shortcoming in my opinion)
Then you do not understand the mathematics underpinning
regular expressions (ie. set theory).
> that can't
> match a "not" string. Where I need <!--(all but "<!--")-->.
If you are processing XML, then you do not need that, as
Comment Declarations cannot be nested.
> This is version .901 from 12-22-05 is the one you want.
No sensible person will want XML processing code written by
someone who has demonstrated repeatedly that they do not
understand the data that is being processed.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Dec 2005 09:09:02 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: perl, v5.8.7 Windows 2003 PPM 3.3
Message-Id: <YxTqf.2646$1Y4.299336@news20.bellglobal.com>
"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message
news:43abd710$0$17706$afc38c87@news.optusnet.com.au...
>
> "Pekka Siiskonen" <pekka_news@yahoo.co.uk> wrote in message
> news:FiOqf.52$IN1.28@read3.inet.fi...
>>
>> So, I got the Nmake15 and installed it (to \perl\bin\) but still am
> getting
>> nowhere. Should I really purchase C/C++ to get the "free" Perl install
>> modules? I must be missing something trivial -- what?
>>
>
> The use of 'CPAN.pm', 'nmake' and VC++ is being cited as an *alternative*
> to
> ppm. You can go that way if you think it's worth the money. Personally, I
> don't think it is worth the money. A better alternative is (imho) to
> install
> dmake and the MinGW compiler - both of which are freely available, and
> both
> of which work seamlessly with the latest build (815) of ActiveState perl.
> If
> you want to use dmake and MinGW with earlier ActiveState builds then you
> should also install ExtUtils::FakeConfig.
>
This question about the ppm documentation seems to pop up every so often
here, so I logged a bug report to AS to hopefully get them to change the
section.
Matt
------------------------------
Date: Fri, 23 Dec 2005 20:13:30 +0800
From: "mehere" <notelling@anyone.com>
Subject: protect perl script from spammers
Message-Id: <43abeab2$1@quokka.wn.com.au>
Hi guys
I have a basic perl script for form processing for various purposes, e.g.
adding results to a text file. What I want to know is how best to protect
the perl script from hijackers spamming the form and thus having my
results.txt file filled with crap.
I could obviously get a different form etc but I'd like to know still how to
protect a form without needing to password protect it. Form is open to
general access like a guestbook. I have been looking at Captcha but I am
not sure if that is the best or easiest way to stop hijackers hijacking my
forms.
Anyway if anyone can provide me with some pointers or betters ways to
protect my forms from being hijacked please let me know and point me to some
code for me to have a look at, or if CAPTCHA is the best way does anyone
have some simple code etc I can use to add to my existing forms.
Cheers
Greg
------------------------------
Date: Fri, 23 Dec 2005 15:15:27 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: protect perl script from spammers
Message-Id: <412f07F1cec8uU1@individual.net>
mehere wrote:
> I have a basic perl script for form processing for various purposes, e.g.
> adding results to a text file. What I want to know is how best to protect
> the perl script from hijackers spamming the form and thus having my
> results.txt file filled with crap.
>
> I could obviously get a different form etc but I'd like to know still how to
> protect a form without needing to password protect it. Form is open to
> general access like a guestbook. I have been looking at Captcha but I am
> not sure if that is the best or easiest way to stop hijackers hijacking my
> forms.
Neither am I. IMO this is about a trade-off between the (in-)convenience
for the users and your own convenience.
Even if the referer header can be faked, a referer check makes it more
difficult to accomplish automated bogus submissions.
But please note that your question is off topic here. I'd recommend that
you seek advice in comp.infosystems.www.authoring.cgi instead. If you
haven't posted there before, read
http://www.thinkspot.net/ciwac/howtopost.html first.
> ... does anyone have some simple code etc ...
http://search.cpan.org/search?query=captcha
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 23 Dec 2005 09:39:34 -0500
From: "Daniel Kaplan" <NoSPam@NoSpam.com>
Subject: Re: protect perl script from spammers
Message-Id: <1135348774.798765@nntp.acecape.com>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:412f07F1cec8uU1@individual.net...
> mehere wrote:
> Even if the referer header can be faked, a referer check makes it more
> difficult to accomplish automated bogus submissions.
>
> But please note that your question is off topic here. I'd recommend that
> you seek advice in comp.infosystems.www.authoring.cgi instead. If you
> haven't posted there before, read
> http://www.thinkspot.net/ciwac/howtopost.html first.
>
I don't want to prolong the thread here since as above you should put it in
the other forum/newsgroup. But what is wrong with Captcha? I am too green
to say that it is definitly the wright or wrong way to go, but if all the
biggie sites use it, how wrong can they all be? If there were a better way,
wouldn't at least "some" of them be using this other method?
Just seems they "all" use Captcha...
Daniel
------------------------------
Date: Fri, 23 Dec 2005 14:50:33 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: protect perl script from spammers
Message-Id: <Z8Uqf.5$X86.0@trnddc04>
mehere wrote:
> I have a basic perl script for form processing for various purposes,
> e.g. adding results to a text file. What I want to know is how best
> to protect the perl script from hijackers spamming the form and thus
> having my results.txt file filled with crap.
Trivial. Two steps:
- Grant execute permissions only to those whom you trust
- enforce authentication and log all activities such that any spammer will
leave a trail. Then HR can take care of them
> I could obviously get a different form etc but I'd like to know still
> how to protect a form without needing to password protect it. Form
> is open to general access like a guestbook.
Oh, you are talking about a web service? Why didn't you say so in the
beginning.
comp.web.authoring.cgi or whatever that NG is called is on the other side of
the hallway
jue
------------------------------
Date: Fri, 23 Dec 2005 15:54:32 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: protect perl script from spammers
Message-Id: <412h9gF1d264lU1@individual.net>
Daniel Kaplan wrote:
> Gunnar Hjalmarsson wrote:
>>Even if the referer header can be faked, a referer check makes it more
>>difficult to accomplish automated bogus submissions.
>
> I don't want to prolong the thread ... But what is wrong with Captcha?
After having stripped the sentence where I explained why I don't
consider captcha to be _the_ solution in all cases, you make it sound as
if I had claimed that captcha is "wrong". By doing so, you indeed
prolonged the thread unnecessarily. ;-)
For the record, I said: "IMO this is about a trade-off between the
(in-)convenience for the users and your own convenience."
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 23 Dec 2005 10:19:06 -0500
From: "Daniel Kaplan" <NoSPam@NoSpam.com>
Subject: Re: protect perl script from spammers
Message-Id: <1135351144.941911@nntp.acecape.com>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:412h9gF1d264lU1@individual.net...
> After having stripped the sentence where I explained why I don't consider
> captcha to be _the_ solution in all cases, you make it sound as if I had
> claimed that captcha is "wrong". By doing so, you indeed prolonged the
> thread unnecessarily. ;-)
>
> For the record, I said: "IMO this is about a trade-off between the
> (in-)convenience for the users and your own convenience."
Yeah, I saw that, must have mis-cut...my intention was to address the
original poster
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 23 Dec 2005 10:24:47 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: protect perl script from spammers
Message-Id: <ZEUqf.2674$1Y4.304857@news20.bellglobal.com>
"Daniel Kaplan" <NoSPam@NoSpam.com> wrote in message
news:1135348774.798765@nntp.acecape.com...
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:412f07F1cec8uU1@individual.net...
>> mehere wrote:
>
>
>> Even if the referer header can be faked, a referer check makes it more
>> difficult to accomplish automated bogus submissions.
>>
>> But please note that your question is off topic here. I'd recommend that
>> you seek advice in comp.infosystems.www.authoring.cgi instead. If you
>> haven't posted there before, read
>> http://www.thinkspot.net/ciwac/howtopost.html first.
>>
>
> I don't want to prolong the thread here since as above you should put it
> in the other forum/newsgroup. But what is wrong with Captcha? I am too
> green to say that it is definitly the wright or wrong way to go, but if
> all the biggie sites use it, how wrong can they all be? If there were a
> better way, wouldn't at least "some" of them be using this other method?
>
Herd mentality does not make things right. I read what was being discussed
not as good/bad, but as inconvenience to the user, which is what any captcha
is.
They also only make it more difficult to abuse a site, not impossible. With
a bit of brain power and a little time (or a really good OCR program) you
could write a program to take the graphic and determine the code. It
probably won't always work (hence the design premise of captchas), but even
1/100 are good odds for spammers.
Matt
------------------------------
Date: 23 Dec 2005 11:19:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: quotes
Message-Id: <dogmf4$sht$1@mamenchi.zrz.TU-Berlin.DE>
Raghuramaiah Gompa <rgompa@steel.ucs.indiana.edu> wrote in comp.lang.perl.misc:
> In article <do7jvk$1ki$1@rainier.uits.indiana.edu>,
> Raghuramaiah Gompa <rgompa@steel.ucs.indiana.edu> wrote:
> >I am "trying" to write a perl code to generate a file
> >with everybody's 'help'.
> >
> >The output should be:
> >
> >I am \myquote{trying} to write a perl code to generate a
> >file with everybody{\justquote}s \singlequote{help}.
> >
> >I know I can handle double quotes, but I am puzzled about
> >single quote as you can see they may occur two different
> >ways.
> >
> >Please help. .. Raghu
>
> I do apologize for my incorrect posting. I do appreciate
> your followup postings. Please forgive me.
>
> My question should have been (more clearly) like this:
>
> I want to develop and run a perl program on a file which
> contains
> single quotes, double quotes, and apostrophes. I want to
...and other text, presumably.
> put each "sentence" (from the input file) under double
> quotes under a macro like
> \myquotes{sentence} (in the output file). This is not a
> problem. But single
> quotes pose a problem. Because things like `please
> forgive me' should be transfered to \singlequote{please
> forgive me}. Apostrophe in Raghu's mistake somehow
> should be left alone (I know I asked a different thing
> before, but I think this is what is needed). The later
> type of apostrophe may occur several ways: you're aren't
> ..
>
> Hope this is clear. Please help. .. Raghu
Clear enough, but your question isn't about Perl, it's not even about
programming but about English. What are the possible uses of singular
single quotes in English text, and how can they be recognized?
I'm no expert, but I believe the central part of that would have to be
a data base of individual cases, along with very few general rules.
It will never be perfect, and you will have to balance the time to
invest in the data base against the perfection you want to achieve.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
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 V10 Issue 8790
***************************************