[18793] in Perl-Users-Digest
Perl-Users Digest, Issue: 961 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 22 18:11:07 2001
Date: Tue, 22 May 2001 15:10:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <990569422-v10-i961@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 22 May 2001 Volume: 10 Number: 961
Today's topics:
Re: non repeating random numbers <goldbb2@earthlink.net>
Re: oh c'mon please, one of you perl/unix gurus!!! <boqichi0@earthlink.net>
problem with linux/cgi perl script (Ja NE)
Programmer for a rogue-clone wanted (GPL) (Erik Wasser)
Re: references trouble nobull@mail.com
Selectively output records from delimited file? <chris.ashley@NOSPAMblueyonder.co.uk>
Re: Selectively output records from delimited file? <todd@designsouth.net>
sorting a scrolling_list() (Wyatt R Johnson)
Re: Time validation <todd@designsouth.net>
Re: Time validation <daryl.l.shute@boeing.com>
url parsing <joycefive@earthlink.net>
Re: url parsing <todd@designsouth.net>
Re: url parsing <bart.lateur@skynet.be>
Re: url parsing <joycefive@earthlink.net>
Re: url parsing <todd@designsouth.net>
Re: url parsing <tony_curtis32@yahoo.com>
using quantifier on a . <rutterba@cisco.com>
Re: using quantifier on a . <uri@sysarch.com>
Re: using quantifier on a . (Randal L. Schwartz)
Re: using quantifier on a . <todd@designsouth.net>
Re: using quantifier on a . <todd@designsouth.net>
Re: using quantifier on a . (Abigail)
Re: wwwboard.pl - Taint and Use Strict nobull@mail.com
Re: wwwboard.pl - Taint and Use Strict <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 22 May 2001 18:01:32 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: non repeating random numbers
Message-Id: <3B0AE1BC.BADDFB2F@earthlink.net>
Anno Siegel wrote:
>
> According to Benjamin Goldberg <goldbb2@earthlink.net>:
>
> [creating a set of unique random numbers]
>
> > Encrypt a counter with a small block cipher. Obviously, since each
> > input value encrypts to exactly one output value, we know that no
> > output will appear more than once provided no input appears more
> > than once. Since the counter will never be any value more than
> > once, this requirement is satisfied. Of course, we need a small
> > block cipher...
>
> [code snipped]
>
> Very well. You would however have to make sure that the cipher used
> doesn't introduce unwanted non-random properties in the resulting
> sequence, or rather, that it creates a sufficiently random sequence
> out of the first few integers. It also makes the random sequence
> predictable, which may be a problem.
It's only predictable if you can guess the internal state. For a four
round Feistel network whos F functions are random (as opposed to
psuedorandom), this is an NP complete problem. See the paper on the
Turtle block cipher and the Hare stream cipher at:
http://citeseer.nj.nec.com/205676.html
Since the start state is created using perl's rand function, which in
turn is seeded with the time, there's only log2(60*60*24)=17 bits of
entropy, if the attacker knows within a day when the script was run.
Deducing the internal state using cryptanalysis is expected to require
significantly more work than this for any decent size permutation.
Also, for a sufficiently large permutation, the number of different
permutations producable by this method is not less than the number of
permutations producable through shuffling, due to the small size of the
rand state.
The only *real* drawback of using this method, versus shuffling, is that
there is more work done with each item produced, since when shuffling,
*all* the work is done beforehand, as precomputation. And that there's
more complexity, but that's expected in any method which significantly
reduces memory usage.
--
Customer: "I would like to try on that suit in the window."
Salesman: "Sorry sir, you will have to use the dressing room."
------------------------------
Date: Tue, 22 May 2001 21:04:59 GMT
From: Franco Luissi <boqichi0@earthlink.net>
Subject: Re: oh c'mon please, one of you perl/unix gurus!!!
Message-Id: <3B0B0050.1EF1B778@earthlink.net>
Steve wrote:
> On Mon, 21 May 2001 02:39:55 GMT, Franco Luissi wrote:
>
> >now i'm back to my original problem, where are the config files/ (how) can i get
> >it to recognize the new perl...?
>
> I thought you said you didn't have root access?
>
i don't. And I guess you are tight that it is off-topic - I just had no luck with
the more OSish newsgroups either - comp.unix.bsd.misc and the like are all spam, no
geeks... so you are saying there is nothing I can do? I was hoping I could at least
view the config if I could find it, even if I can't write to it. Then maybe if I
know *exactly* what I need the server admin to do, then when I ask s/he will do it.
If I just say "the web sever doesn't seem to recognize the perl i installed" I know
the response I will get - it will be a long run around with finally "you don't
receive tech support from us"... anyway, thanks for the help- any more suggestions
would be greatly appreciated, and you can email me @ myluck42@yahoo.com
------------------------------
Date: Tue, 22 May 2001 23:48:03 +0200
From: janko@bellay.com (Ja NE)
Subject: problem with linux/cgi perl script
Message-Id: <1etu1a6.15qgs8afs0k4N%janko@bellay.com>
soory if this is'n appropriate place to ask (hope it is) but I'm in real
trouble... and sorry on bad english.
Problem is in understanding language - yes, I think that I'm under the
level of 'novice'. I'm working on script called "soupermail", have lot
of nice features, I just need to activate them...
here is my config file in which I have tryed to tell soupermail that
attachment must have ".jpg" in name... but it isn't working...
# begining of config file #
required: Email
required: name
required: attach
failure: missing.txt
success: tnx.txt
wrong: jpeg.txt
mailto: upload@mydomain.org
subject: picture
mimeon: yes
unless: attach contains '.jpg' then wrong: jpeg.txt
# end of config file #
# begining with segment of log file #
setConfig (unless attach contains '.jpg' then wrong: jpeg.txt) @
990541142
parseCondition (attach contains '.jpg' then wrong: jpeg.txt 1) @
990541142
Got cond attach contains '.jpg' then wrong: jpeg.txt
[attach contains '.jpg'] [wrong] [jpeg.txt]
Looking at condition attach contains '.jpg'
securityName (attach) @ 990541142
field = attach; op = contains; val = .jpg
Should eval condition 0
setConfig (wrong jpeg.txt) @ 990541142
# end of segment of log file #
[I don't understand much of above :( did my program or did not found
".jpg"?]
# start of tail of log file #
Upload fotozinedotorg.gif
Content-Type => image/gif
Content-Disposition => form-data; name="attach";
filename="photozine.gif"
Upload mime image/gif
Upload name photozine.gif
Sending mail to upload@mydomain.org or test@mydomain.org
cleanScratch () @ 990541142
# end of tail of log file #
heh? there is no ".jpg" in "fotozinedotorg.gif"
any help? please ... tnx
--
Ja NE
--
------------------------------
Date: Tue, 22 May 2001 20:31:34 +0200
From: fuzz@uni-paderborn.de (Erik Wasser)
Subject: Programmer for a rogue-clone wanted (GPL)
Message-Id: <6abee9.281.ln@wasser-7359.user.cis.dfn.de>
Programmer for a rogue-clone wanted (GPL)
I want to write a RPG like the old line of traditionell games like
Moria, Angband, Omega, Nethack, Rogue, Gauntlet or Muds. I have many
ideas about the creation of the new game. I got ideas of the game and
of the programming of the game.
Here some keywords:
[FIX] 'realtime'
[FIX] Perl
[FIX] Some kind of Rolemaster system for fighting and skills.
[STC] Postatomar Story
[STC] GUI 'ncurses'
[STC] Casting spells vs. using PSI
FIX = This is so. There should be no discussion about it.
STC = Subject to change.
Long Version:
[FIX] 'realtime':
Every action takes a amount of time. Turns are not the wheel of time.
The resolution for time is a second not a turn. With this option we
can simulate night & day. And fighting could be more realistic. If
it the players's turn, he can think about his next move with all the
time of the world. But if he makes a move the clock jumps forward 1
minute, 2 or 10h. Or if a monster is attacking only 5 seconds and the
action is interrupted.
[FIX] Perl:
I want to write the whole game in perl. I think the days of the good
old char arrays of C are over. I want to care about the content of a
string, not of the length. That's some of the reasons I choose Perl.
[FIX] Rolemaster System:
I want to transfer many skills from rolemaster (for the expert: only
the name of the skills not all the table sheets B-) to the RPG.
[STC] Postatomar Story:
Don't worry if you don't like it. If the majority is against it, I
will drop the story for a conventinial one. I think someabout about
like Fallout, you (the charakter) is climbing out his bunker and is
stunned, because the world is so different.
[STC] GUI 'ncurses':
We should take ncurses for the gui. ncurses is simply and supports
different windows (map windows, text window, inventory window). The
alternative would be Tk. Tk has many advantages. It's 'modern', object
orientated, colored and that stuff.
[STC] Casting spells vs. using PSI
Casting spells is old fashioned and used a lot of times. PSI in this
kind of games, could be new and refreshing. (I know it's only the same
thing unter a different name.)
Programming ready:
The basic event system is ready. Every object in the world can set a
timer wenn it should be called again with this a method. So the
enviroment (the map) can say: 'mmmh... in 20 minutes I will roll
against a random encounter'.
If the player decides to move, the map tile (a field) will tell the
player through a timespan object how long he took to walk through the
field. It can be different and varies with a lot of things. Swap is
heaver than forrest and so on. If he needs 8 minutes to walk through a
field, a busy object is connected to the player object. If someone
wants to disturb the player during the busy-time (a monster is
attacking) the busy object "decides" what to do.
Programming todo:
A lot of things. Monster, Spells & PSI, Maps, Story, AI for the
monster, Spells..., maybe mySQL support for the tables of random
encounters in the wilderness, combat system.
Sourceforge project named 'progue':
- Development Status: 2 - Pre-Alpha
- Intended Audience: End Users/Desktop
- License: GNU General Public License (GPL)
- Natural Language: English
- Operating System: Windows 95/98/2000, Linux
- Programming Language: Perl
- Topic: Role-Playing
So I you are interested in this project, drop me a mail
(mailto:erik.wasser@iquer.de)
--
So long... Fuzz
------------------------------
Date: 22 May 2001 18:56:41 +0100
From: nobull@mail.com
Subject: Re: references trouble
Message-Id: <u9d7918dye.fsf@wcl-l.bham.ac.uk>
"R" <smrtalec@nospam.earthlink.net> writes:
> when I try to test my hash reference I get an error. what am I
> doing wrong
That's easy, you are posting to Usenet saying "I get an error",
without even describing the error much less quoting it verbatim. You
also failed to post a complete test script that we could run to
reproduce the error.
Oh, and you are cross-posting a non-existant newsgroup too.
Now what was your real question?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 22 May 2001 20:08:04 GMT
From: Chris Ashley <chris.ashley@NOSPAMblueyonder.co.uk>
Subject: Selectively output records from delimited file?
Message-Id: <mkhlgt4l6lbga4pps6l3rlvvob4g7va6id@4ax.com>
I'm in the middle of developing a CGI quiz application at the moment.
I'm at the stage where I have the input being sent to my script from
POST, which then caclulates the result and appends it (along with
other details) to the bottom of a comma delimited text file like so:
name,email,result
newname,newemail,newresult
This works fine for me, but I'm now looking to do a high score table
of sorts - I need to read that file with perl, and only output the top
10 results fields along with the other details. I can make it output
the entire file, but any kind of arrangement of results seems to be
above me. I'm really a perl beginner (but learning!), and would be
grateful for any help with the above - where do I start? :)
Thanks in advance for any help!
Kind regards,
Chris
------------------------------
Date: Tue, 22 May 2001 21:41:28 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Selectively output records from delimited file?
Message-Id: <c2BO6.57107$I5.12485980@news1.rdc1.tn.home.com>
"Chris Ashley" <chris.ashley@NOSPAMblueyonder.co.uk> wrote in message
news:mkhlgt4l6lbga4pps6l3rlvvob4g7va6id@4ax.com...
> I'm in the middle of developing a CGI quiz application at the moment.
> I'm at the stage where I have the input being sent to my script from
> POST, which then caclulates the result and appends it (along with
> other details) to the bottom of a comma delimited text file like so:
>
> name,email,result
> newname,newemail,newresult
>
> This works fine for me, but I'm now looking to do a high score table
> of sorts - I need to read that file with perl, and only output the top
> 10 results fields along with the other details.
And you're making the quiz?
This assumes the "result" is just an integer:
# @lines- each is name,email,result
@show = (sort { (split ',', $b)[2] <=> (split ',', $a)[2] } @lines)[0..9];
-todd
------------------------------
Date: Tue, 22 May 2001 19:11:01 +0000 (UTC)
From: wjohnson@roger.ecn.purdue.edu (Wyatt R Johnson)
Subject: sorting a scrolling_list()
Message-Id: <9eedk5$7ot$1@mozo.cc.purdue.edu>
I'm doing some CGI stuff with a syntax like
my $q=new CGI;
print $q->scrolling_list(
-name => "myname",
-values => \%hashref,
-size => 1);
And when I look at the scrolling_list on the form, the visible labels
are being printed according to however they get hashed in the hash table.
The only way I know of specifying an order is by using an array reference
instead of a hash reference, but then I lose the functionality of
having a different internal representation of the data.
Is there a way to force the scrolling_list to display in a specified
order and/or a sorted order?
(For some of these, I'd like an alphabetical sort. But for others,
I'd like them sorted in a different manner)
Thanks
Wyatt
--
98% of the population is asleep. The other 2% are staring around in complete
amazement, abject terror, or both.
------------------------------
Date: Tue, 22 May 2001 18:44:08 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Time validation
Message-Id: <YryO6.56866$I5.12382685@news1.rdc1.tn.home.com>
"Daryl Shute" <daryl.l.shute@boeing.com> wrote in message
news:GDqs1x.3zI@news.boeing.com...
> I have a form that needs to be submitted only during the hours of 0600 -
> 1515 Monday through Friday, and not on Holidays. If the time or date is
not
> in this time frame I need to send the user to another WebPage, otherwise
> allowing the user to continue on with the form submission.
> Any help would be greatly appreciated.
> Thanks in advance.
> Daryl Shute
>
You should try the module Date::Manip from cpan.org. You can check to see if
a date is in a certain range, before or after times like you want, and I
think the new versions can check on holidays for you too.
------------------------------
Date: Tue, 22 May 2001 19:42:43 GMT
From: "Daryl Shute" <daryl.l.shute@boeing.com>
Subject: Re: Time validation
Message-Id: <GDr5F6.wq@news.boeing.com>
Thank you.
"Todd Smith" <todd@designsouth.net> wrote in message
news:YryO6.56866$I5.12382685@news1.rdc1.tn.home.com...
>
> "Daryl Shute" <daryl.l.shute@boeing.com> wrote in message
> news:GDqs1x.3zI@news.boeing.com...
> > I have a form that needs to be submitted only during the hours of 0600 -
> > 1515 Monday through Friday, and not on Holidays. If the time or date is
> not
> > in this time frame I need to send the user to another WebPage, otherwise
> > allowing the user to continue on with the form submission.
> > Any help would be greatly appreciated.
> > Thanks in advance.
> > Daryl Shute
> >
>
> You should try the module Date::Manip from cpan.org. You can check to see
if
> a date is in a certain range, before or after times like you want, and I
> think the new versions can check on holidays for you too.
>
>
------------------------------
Date: Tue, 22 May 2001 20:17:19 GMT
From: "Patrick Joyce" <joycefive@earthlink.net>
Subject: url parsing
Message-Id: <jPzO6.22278$BN6.931952@newsread1.prod.itd.earthlink.net>
Hey, my name is patrick joyce and im a newbe to perl.
I need a program that takes a url and strips out everything but the domain
this would normally not be as hard but i need this to work for such urls as
".com.au, .co.jp" and "foo.me.com, hi.test.you.com" so if my url was
http://www.tiac/net/users/candvr
then i would only want tiac.net. i'm using lwp and can grab the urls i just
need help parsing them.
Much thanks,
Patrick Joyce
joycefive@earthlink.net
------------------------------
Date: Tue, 22 May 2001 20:19:20 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: url parsing
Message-Id: <cRzO6.56923$I5.12436495@news1.rdc1.tn.home.com>
"Patrick Joyce" <joycefive@earthlink.net> wrote in message
news:jPzO6.22278$BN6.931952@newsread1.prod.itd.earthlink.net...
> Hey, my name is patrick joyce and im a newbe to perl.
> I need a program that takes a url and strips out everything but the domain
> this would normally not be as hard but i need this to work for such urls
as
> ".com.au, .co.jp" and "foo.me.com, hi.test.you.com" so if my url was
> http://www.tiac/net/users/candvr
> then i would only want tiac.net. i'm using lwp and can grab the urls i
just
> need help parsing them.
On first guess, I'd do this:
$url =~ m|http://(.+?)/|;
$domain = $1;
------------------------------
Date: Tue, 22 May 2001 20:43:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: url parsing
Message-Id: <jmjlgtk1s28dnsbsaudjgg52kuretlqn7m@4ax.com>
Patrick Joyce wrote:
>http://www.tiac/net/users/candvr
>then i would only want tiac.net.
That ain't right. I guess it's your URL that is wrong. Replace the slash
just before the "net" with a dot.
But Todd Smith's code ought to work, except when it fails. I mean: if
the regex doesn't match, $1 won't be reset.
$url = 'http://www.tiac.net/users/candvr';
$url =~ m|http://(.+?)/|; # succeeds
$url =~ /(babe)/; # fails to match
$domain = $1;
print $domain;
-->
www.tiac.net
This is safer:
($domain) = $url =~ m|http://(.+?)/|;
If it fails to match, $domain will be undef().
--
Bart.
------------------------------
Date: Tue, 22 May 2001 20:50:31 GMT
From: "Patrick Joyce" <joycefive@earthlink.net>
Subject: Re: url parsing
Message-Id: <riAO6.22326$BN6.938446@newsread1.prod.itd.earthlink.net>
thanks i found that this works great
$urla = 'https://www.boston.com/foo/me/who?hg=ww;
($url = $urla) =~ s|.*//(.*?)/.*|$1|;
print "$url\n";
------------------------------
Date: Tue, 22 May 2001 21:08:33 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: url parsing
Message-Id: <lzAO6.57035$I5.12466254@news1.rdc1.tn.home.com>
"Patrick Joyce" <joycefive@earthlink.net> wrote in message
news:riAO6.22326$BN6.938446@newsread1.prod.itd.earthlink.net...
> thanks i found that this works great
>
> $urla = 'https://www.boston.com/foo/me/who?hg=ww;
> ($url = $urla) =~ s|.*//(.*?)/.*|$1|;
> print "$url\n";
>
That's too much. But I did forget about ftp:// and https://, so let's do
this:
$url =
protocol://prefix.domain.suffix1.suffix2/dir1/dir2/script.scipt_ext?arg1=val
1
$url =~ m|/(.+?)/|;
$domain = $1 if $1;
the first set of characters between /'s should be the domain, right? And if
$1 doesn't match, $domain will stay undefined. Everybody wins.
------------------------------
Date: 22 May 2001 16:55:50 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: url parsing
Message-Id: <87snhxvyjd.fsf@limey.hpcc.uh.edu>
>> On Tue, 22 May 2001 20:17:19 GMT,
>> "Patrick Joyce" <joycefive@earthlink.net> said:
> Hey, my name is patrick joyce and im a newbe to perl. I
> need a program that takes a url and strips out
> everything but the domain this would normally not be as
> hard but i need this to work for such urls as ".com.au,
> .co.jp" and "foo.me.com, hi.test.you.com" so if my url
> was http://www.tiac/net/users/candvr then i would only
> want tiac.net. i'm using lwp and can grab the urls i
> just need help parsing them.
An alternative to regexps is to use the URI module:
use URI;
my $u = new URI 'http://www.myserver.com/path/to/info';
print $u->host, "\n";
==> "www.myserver.com"
"perldoc URI"
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Tue, 22 May 2001 13:32:02 -0500
From: "R. Utterback" <rutterba@cisco.com>
Subject: using quantifier on a .
Message-Id: <990556493.796455@sj-nntpcache-3>
All,
I am trying to match a line which starts with 3 of any character, like
"aaabcde" or "999 test". I tried:
/^(.){3}/
This doesn't work: it matches any three characters at the beginning of the
line.
The FAQ gets close, but doesn't answer my question.
Help is appreciated.
Robert
------------------------------
Date: Tue, 22 May 2001 18:35:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: using quantifier on a .
Message-Id: <x7r8xh5j0a.fsf@home.sysarch.com>
>>>>> "RU" == R Utterback <rutterba@cisco.com> writes:
RU> I am trying to match a line which starts with 3 of any character, like
RU> "aaabcde" or "999 test". I tried:
RU> /^(.){3}/
RU> This doesn't work: it matches any three characters at the
RU> beginning of the line.
well sure, . matches any char. you want to force the 2 chars afterwards
to be the same as the first. this is done with a backreference:
/^(.)\1\1/
note that is not the same as $1 and that \1 is not to be used outside
the regex itself (though that may work, $1 is the correct way to grab
things).
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: 22 May 2001 11:36:18 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: using quantifier on a .
Message-Id: <m1bsolmdst.fsf@halfdome.holdit.com>
>>>>> "R" == R Utterback <rutterba@cisco.com> writes:
R> I am trying to match a line which starts with 3 of any character, like
R> "aaabcde" or "999 test". I tried:
R> /^(.){3}/
R> This doesn't work: it matches any three characters at the beginning of the
R> line.
You can't get "later must be same as earlier" until you use backreferences:
/^(.)\1\1/
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 22 May 2001 18:39:03 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: using quantifier on a .
Message-Id: <bnyO6.56864$I5.12380068@news1.rdc1.tn.home.com>
"R. Utterback" <rutterba@cisco.com> wrote in message
news:990556493.796455@sj-nntpcache-3...
> All,
>
> I am trying to match a line which starts with 3 of any character, like
> "aaabcde" or "999 test". I tried:
>
> /^(.){3}/
>
> This doesn't work: it matches any three characters at the beginning of the
> line.
>
> The FAQ gets close, but doesn't answer my question.
>
> Help is appreciated.
>
> Robert
>
>
try
if (/./ and /^$&$&$&/) {}
------------------------------
Date: Tue, 22 May 2001 18:40:37 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: using quantifier on a .
Message-Id: <FoyO6.56865$I5.12381199@news1.rdc1.tn.home.com>
uh, yeah, use backreferences. I'm gonna get out of here before Randal jumps
my case again
------------------------------
Date: Tue, 22 May 2001 19:22:14 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: using quantifier on a .
Message-Id: <slrn9glf36.jrh.abigail@tsathoggua.rlyeh.net>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDCCCXXI September
MCMXCIII in <URL:news:m1bsolmdst.fsf@halfdome.holdit.com>:
'' >>>>> "R" == R Utterback <rutterba@cisco.com> writes:
''
'' R> I am trying to match a line which starts with 3 of any character, like
'' R> "aaabcde" or "999 test". I tried:
''
'' R> /^(.){3}/
''
'' R> This doesn't work: it matches any three characters at the beginning of the
'' R> line.
''
'' You can't get "later must be same as earlier" until you use backreferences:
''
'' /^(.)\1\1/
''
'' print "Just another Perl hacker,"
Sure you can.
{
local $" = "|";
my @x = map {chr ($_) x 3} 0x00 .. 0xFF; # Assuming Latin-X.
/^(@x)/
}
Perhaps not the most convenient, nor the most efficient. But never say
never with Perl.
Abigail
--
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
. "\162\1548\110\141\143\153\145\162\0128\177" and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}
------------------------------
Date: 22 May 2001 19:32:05 +0100
From: nobull@mail.com
Subject: Re: wwwboard.pl - Taint and Use Strict
Message-Id: <u9ae458cbe.fsf@wcl-l.bham.ac.uk>
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> Jill wrote:
>
> (snippage)
>
> > I have modified wwwboard.pl from Matts Script Archive for use on my
> > website. Now I find that I am required to use the "-T" (Taint) switch
> > and "Use Strict" pragma for security reasons.
>
> Neither Taint nor Strict are required. There is nothing about
> perl core which "requires" you to use these pragma. Use of Taint
> is a very poor approach to effective and efficient script security.
In precisely the same way that ropes are a very poor approach to
safety when climbing mountains. If you come to rely on the rope to
hold your weight you may well be at greater risk than you would be
without the rope. If you climb as though the rope wasn't there and
rely on it only to stop you if you start to fall you are safer. As
with climbing ropes there are parts of a script where taint may turn
out to be just so much excess baggage.
> Use of strict is unrelated to security.
Largely true. The sorts of mistakes and bad habits that "use strict
qw(subs vars)" will prevent are much more likely to impact reliability than
security.
The sorts of _mistakes_ that "use strict qw(refs)" catches will
occasionally have an impact on security. The sorts of bad habits that
"use strict qw(refs)" discourages will quite often have an impact on
security.
Note the distinction here, accidentally having an expression that
evaluates to a string in a reference context is a mistake that only
occasionally impacts security. Deliberately using symbolic references
where they are not the best tool for the job is a bad habit that may
often impact security.
> > I have read the relevant perl documentation and references to both
> > these things in several books, but am unable to put the instructions
> > for untainting and declaring variables into practice.
What happens when you try? Do your hands fall off?
> A clear logical approach would be to research and read about how
> to use these features via resources other than Perl documentation
> and those books which are available to you.
Did I just parse that correctly? You are suggesting that the OP use
documentation _other_ than that which is available to him!? Isn't
this a tautological impossiblity? Or are you suggesting resources
other than documentation and books? Like, say, Usenet groups?
I often wonder why you (Godzilla) so keen to criticise the ability of
me (NoBull) and other to express ourselves clearly in English when are
so very poor at it yourself.
> Do your homework.
Having done your homework, if you have questions then feel free to
come here and ask them.
In fact, I suspect the OP _has_ done her/his homework, and has got
some questions, and he has come here (s)he has then for (reasons I
can't fathom) _not_ asked those questions.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 22 May 2001 12:23:22 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: wwwboard.pl - Taint and Use Strict
Message-Id: <3B0ABCAA.2260E407@stomp.stomp.tokyo>
nobull@mail.com wrote:
> Godzilla! wrote:
> > Jill wrote:
> > (snippage)
(more snippage of congenial remarks)
> > > I have read the relevant perl documentation and references to both
> > > these things in several books, but am unable to put the instructions
> > > for untainting and declaring variables into practice.
> What happens when you try? Do your hands fall off?
> > A clear logical approach would be to research and read about how
> > to use these features via resources other than Perl documentation
> > and those books which are available to you.
> Did I just parse that correctly? You are suggesting that the OP use
> documentation _other_ than that which is available to him!? Isn't
> this a tautological impossiblity? Or are you suggesting resources
> other than documentation and books? Like, say, Usenet groups?
> I often wonder why you (Godzilla) so keen to criticise the ability of
> me (NoBull) and other to express ourselves clearly in English when are
> so very poor at it yourself.
The originating author indicated,
"...relevant perl documentation...."
"...things in several books...."
My response is,
"... resources other than Perl documentation and those
books which are available to you."
There are literally hundreds of resources pertaining to Perl
available within our internet. Doing your homework includes
researching those resources. There are more books than the
"several books" cited. Perl resources are almost innumerable.
Clearly you face challenges in associative thinking
as many others here do. Give careful thought to my,
"...which are available to you."
Ask an English teacher, other than myself, to help you
with reading comprehension if you still face challenges
understanding the context of my words.
Godzilla!
------------------------------
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.
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 961
**************************************