[18834] in Perl-Users-Digest
Perl-Users Digest, Issue: 1002 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 28 09:05:35 2001
Date: Mon, 28 May 2001 06:05:10 -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: <991055109-v10-i1002@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 28 May 2001 Volume: 10 Number: 1002
Today's topics:
Re: CGI and printing vars (Anno Siegel)
Re: Constant -vs- Variable File Handles? (Anno Siegel)
Re: convert letters to numbers <jonni@ifm.liu.se>
Re: convert letters to numbers (Martien Verbruggen)
Re: htpasswd and crypt with perl problem <pizzadelivery@netscape.net>
Re: Locking files (Anno Siegel)
Looking for perl programming article writers (William Cross)
Looking for Programmers - Numerous projects (William Cross)
Re: perl history (*?) <bart.lateur@skynet.be>
Re: perl history (*?) (Martien Verbruggen)
printing contents of a file to html <"relaxedrob@optushome.com.au">
Re: printing contents of a file to html <bart.lateur@skynet.be>
Re: printing contents of a file to html (Tony L. Svanstrom)
Re: printing contents of a file to html <"relaxedrob@optushome.com.au">
Re: Question <scott.bell1@ntlworld.com>
Re: Question <godzilla@stomp.stomp.tokyo>
Re: Searching Flat Text File <bart.lateur@skynet.be>
simple question <anarch1st@yahoo.com>
SMTP Client in perl <kay_schulz@yahoo.com>
Re: SMTP Client in perl (Rafael Garcia-Suarez)
Text Searching Script Problems <newwave@ACMEmail.net>
Threads + perl 5.7.1 + RedHat 7.0 <jmerelo@geneura.ugr.es>
Re: Too late for "-T" option at comment_form.cgi line 1 <davsoming@lineone.net>
typeglobs (again) (Grod)
Re: url parsing <iltzu@sci.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 May 2001 08:50:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CGI and printing vars
Message-Id: <9et3gr$449$2@mamenchi.zrz.TU-Berlin.DE>
According to Benjamin Goldberg <goldbb2@earthlink.net>:
[...]
> Strange, the syntax for map allows the form:
>
> map EXPR,LIST
>
> What I have is:
>
> my %in = map encode_entities $_, $cgi->Vars;
>
> I don't see how or why this is not enough arguments.
Perl parses this as "map encode_entities( $_, $cgi->Vars)", where
map is indeed missing the second argument.
Anno
------------------------------
Date: 28 May 2001 12:17:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Constant -vs- Variable File Handles?
Message-Id: <9etfkt$dat$1@mamenchi.zrz.TU-Berlin.DE>
According to Robert <pettyr_no_spam@hotmail.com>:
>
> <nobull@mail.com> wrote in message news:u9y9rl4gbz.fsf@wcl-l.bham.ac.uk...
> > > my ($FH) = "";
> > > open ($FH, "< /etc/passwd");
> >
> > Loose the ="" bit. You want to be using filehandle reference
>
> Seems I am just experienced enough to be dangerous... I have not been using
> strict due to the difficulties with constant filehandle names and not
^^^^^^^^^^^^^^^^^^^
Just a remark on terminology: What you call a "constant" filehandle
is usually termed a "direct filehandle", as opposed to an indirect
one where you use a scalar variable to hold it. A direct filehandle
is actually another type of Perl identifier like "$scalar" or "%hash",
it just doesn't have a funny character associated with it. It isn't
any more constant than the others, only you don't use assignment but
open() to change its "value".
Anno
------------------------------
Date: Mon, 28 May 2001 09:25:40 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: convert letters to numbers
Message-Id: <9esues$hck$1@newsy.ifm.liu.se>
> how do i convert a string of text (username) like "Eric Marques" to a
number
> converting back doesnt matter i dont need it
$string='Jonas';
$number=join '',map sprintf('%03i',ord),split(//,$string);
Would give you a unique number for each string. The numbers will however be
large.
/jN
--
_______________________________
Jonas Nilsson
------------------------------
Date: Mon, 28 May 2001 22:23:49 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: convert letters to numbers
Message-Id: <slrn9h4gql.c3r.mgjv@martien.heliotrope.home>
[Please, in the future, put your reply _after_ the suitably trimmed text
you reply to. It's the commonly accepted quoting style on this
newsgroup, and Usenet in general. Thanks]
On Sun, 27 May 2001 22:22:49 GMT,
Eric <mail@NOSPAMericmarques.net> wrote:
>
> "Bart Lateur" <bart.lateur@skynet.be> wrote in message
> news:e8t2ht041d2765eesgghcoe3r5473l5lv5@4ax.com...
>> Eric wrote:
>>
>> >how do i convert a string of text (username) like "Eric Marques" to
>> >a number converting back doesnt matter i dont need it
>>
>> What number?
>>
>> if($username eq 'Eric Marques') {
>> return 42;
>> }
>>
>> I don't think this is what you want.
>
> OK to be more specific
> i want to convert a text string into a number
> like convert "Eric" into a number "4573454353"
> each time i convert "Eric" it will always give me the same number
> if i convert a different string like "Eric Marques" it will give me a
> different number like "9567436434" and will always give me the same number
> for the same string
>
> its a little like the crypt() function except it will return only numbers
You still don't specify exactly what it is you need. Do you want each
string to result in a unique number? Or is it ok if multiple strings
give the same number, as long as an identical string always gives the
same result?
If you want unique numbers for each string, you could convert each
character to its ordinal value (see the ord function). If multiple
strings can map to the same number, then all you need is a hashing
function. The MD5 modules provide some good ones.
The crypt() function you use as an example is a hashing function.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia |
------------------------------
Date: Mon, 28 May 2001 10:50:19 +0200
From: Christian Bäumle <pizzadelivery@netscape.net>
Subject: Re: htpasswd and crypt with perl problem
Message-Id: <pizzadelivery-A61186.10501928052001@news.unisource.ch>
In article <3b0bbc2d$1@news.i-one.at>, "Tom Klinger"
<admin@the-piper.net> wrote:
> "Christian Bäumle" <pizzadelivery@netscape.net> wrote in message
> news:pizzadelivery-614768.15111023052001@news.unisource.ch...
> > What's going wrong here? The code below works find and writes a
> > user/password pair into the .htpasswd-file. Accessing the secure
> > directory by browser the I'm not able to manage with this user/pass
> > values.
> >
> You're not able to manage what? The password or to login into your secured
> realm?
>
>
> > srand(time ^ $$);
> > @saltchars=('a'..'z','A'..'Z',0..9,'.','/');
> > $salt=$saltchars[int(rand($#saltchars+1))];
> > $salt.=$saltchars[int(rand($#saltchars+1))];
> >
> I'd rather use
>
> my $salt = join '', ('.', '/', 0..9, 'A'..'Z','a'..'z')[rand 64, rand 64];
>
> Tom
>
>
That's it, it works fine with your "salt-maker". Thanks for your help.
Christian
------------------------------
Date: 28 May 2001 08:28:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Locking files
Message-Id: <9et27b$449$1@mamenchi.zrz.TU-Berlin.DE>
According to terminalsplash <shino_korah@yahoo.com>:
> I have a program writing to a file A.txt.
> I have to process this file,so I lock the A.txt and then copy it to another
> file B.txt and release the lock
> This is my code
> open(FD, "A.txt") or die "can't open ::$!\n";
> flock(FD,LOCK_SH) or die "can't lock :;$!\n";
> if(!copy("A.txt","B.txt")){
> print "Error in copying :: $!\n";
> }
> close (FD);
>
> But sometimes I get an error saying
> Error in copying :: Stale NFS file handle
>
> Why am I getting this error when I'm locking this file?
This has nothing to do with Perl. Apparently A.txt resides on an
NFS-mounted file system. This means that the file is actually accessed
via a network. When the network fails, you get a formally open file
handle that can't (temporarily or permanently) deliver its data.
Note there may be problems with locking NFS-mounted files even when
NFS works fine. You should read the FAQ "How can I lock a file", which
points out the problem and possible solutions.
Anno
------------------------------
Date: 28 May 2001 05:50:28 -0700
From: william@perlcoders.com (William Cross)
Subject: Looking for perl programming article writers
Message-Id: <759114d.0105280450.601ab@posting.google.com>
Hello all,
PerlCoders dot com is looking for someone who can write professional
articles or mini tutorials on perl programming. If this is you please
contact Jaime at jaime@perlcoders.com
------------------------------
Date: 28 May 2001 05:48:20 -0700
From: william@perlcoders.com (William Cross)
Subject: Looking for Programmers - Numerous projects
Message-Id: <759114d.0105280448.7f12106e@posting.google.com>
Hello all,
PerlCoders dot com currently has 2 openings for perl programmers. You
can get an idea of what we do at the site. If interested please email
jaime with resume and example urls of your prior work.
jaime@perlcoders.com
------------------------------
Date: Mon, 28 May 2001 09:47:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: perl history (*?)
Message-Id: <qd74htk4k6r44b7lithsh47jjsptrg13re@4ax.com>
Trond Michelsen wrote:
>> I think the *? AKA non-greedy matching was added in 5.005.
>
>$ /local/perl/5.001/bin/perl -le 'print "(abc)(def)" =~ /\((.*?)\)/'
>abc
>
>Nope. It works in 5.001 as well.
Oh. Perl on the Mac is still at 5.004, and there are some regex
additions that people using it, dearly miss. But, now you made me think
of it, I'm sure its was lookbehind I must have been thinking of, not
the non-greedy matching, that is new in 5.005. My bad.
BTW a few of the latest perldelta's can still be found on
<www.perl.com>.
--
Bart.
------------------------------
Date: Mon, 28 May 2001 22:35:23 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perl history (*?)
Message-Id: <slrn9h4hgb.c3r.mgjv@martien.heliotrope.home>
On Sun, 27 May 2001 17:38:10 GMT,
Charles Blair <c-blair@uiuc.edu> wrote:
>
> For example, I have written something that uses the *?
> capability for regular expressions. I'm pretty sure this
> was not in 4.036, which (I think) means that a lot of people
> with five-year-old installations won't be able to run it.
Perl 4 is older than 5 years.
$ man perlhist
[SNIP]
Larry 4.036 1993-Feb-05 Very stable.
[SNIP]
Larry 5.000 1994-Oct-17
[SNIP]
And to confirm your assumption:
$ /opt/perl4/bin/perl -v
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
[SNIP]
$ /opt/perl4/bin/perl -wl
$_ = "foobarbar";
m/^(.*?)bar/;
/^(.*?)bar/: nested *?+ in regexp at - line 2.
Martien
--
Martien Verbruggen | The problem with sharks is that they
Interactive Media Division | are too large to get to the shallow
Commercial Dynamics Pty. Ltd. | end of the gene pool. -- Scott R.
NSW, Australia | Godin
------------------------------
Date: Mon, 28 May 2001 11:36:01 GMT
From: "Rob" <"relaxedrob@optushome.com.au">
Subject: printing contents of a file to html
Message-Id: <BKqQ6.4650$25.16755@news1.eburwd1.vic.optushome.com.au>
Howdy all!
I am trying to read the contents of a text file and display it on a html
page using perl (and Apache).
This is the relevant code. 'text.txt' is a file that resides in the same
directory as the perl script.
Now, this works from DOS fine and displays the contents, but when I run the
html (with Apache running) I get the "Can't open test.txt: No such file or
directory" message.
Can anyone tell me what might be different between the two?
my $line;
open (GRADES, "test.txt") or print "Can't open test.txt: $!<br>";
while ($line = <GRADES>)
{
print $line;
} #end while
Thanks!
Rob
------------------------------
Date: Mon, 28 May 2001 11:57:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: printing contents of a file to html
Message-Id: <0bf4htcbsljb7kifccjvqdfuukf30g9ljt@4ax.com>
Rob wrote:
>Now, this works from DOS fine and displays the contents, but when I run the
>html (with Apache running) I get the "Can't open test.txt: No such file or
>directory" message.
>
>Can anyone tell me what might be different between the two?
>
>my $line;
>open (GRADES, "test.txt") or print "Can't open test.txt: $!<br>";
The current directory (AKA "working directory") your script is run in.
Try an absolute path (a file path, not an URL) for opening your text
file.
--
Bart.
------------------------------
Date: Mon, 28 May 2001 12:20:42 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: printing contents of a file to html
Message-Id: <1eu4ft1.11aesdl14pnygwN%tony@svanstrom.com>
Rob <"relaxedrob@optushome.com.au"> wrote:
> Now, this works from DOS fine and displays the contents, but when I run the
> html (with Apache running) I get the "Can't open test.txt: No such file or
> directory" message.
~full/path/to/the/file.problem
/Tony
--
########################################################################
I'm sorry, I'm sorry; actually, what I said was:
HOW WOULD YOU LIKE TO SUCK MY BALLS?
- South Park -
------------------------------
Date: Mon, 28 May 2001 12:25:15 GMT
From: "Rob" <"relaxedrob@optushome.com.au">
Subject: Re: printing contents of a file to html
Message-Id: <LsrQ6.4665$25.16839@news1.eburwd1.vic.optushome.com.au>
Howdy Bart!
I see.. thanks for the reply my friend!
Is there any way to avoid using an absolute file path in this case?
Thanks!
Rob
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:0bf4htcbsljb7kifccjvqdfuukf30g9ljt@4ax.com...
> Rob wrote:
>
> >Now, this works from DOS fine and displays the contents, but when I run
the
> >html (with Apache running) I get the "Can't open test.txt: No such file
or
> >directory" message.
> >
> >Can anyone tell me what might be different between the two?
> >
> >my $line;
> >open (GRADES, "test.txt") or print "Can't open test.txt: $!<br>";
>
> The current directory (AKA "working directory") your script is run in.
>
> Try an absolute path (a file path, not an URL) for opening your text
> file.
>
> --
> Bart.
------------------------------
Date: Mon, 28 May 2001 11:48:22 +0100
From: "scott.bell1" <scott.bell1@ntlworld.com>
Subject: Re: Question
Message-Id: <IZpQ6.7959$WD.1999822@news2-win.server.ntlworld.com>
This works great, thanks. The only problem is I have to make the ipdata.txt
file writeable for everyone which means anyone with an account on my shell
could change it, so I'll give the URL out and get hacked. ;o)
By the way, I've tried to fix my email address settings several times but my
dialup software insists on changing them back. ;o)
--
Scott Bell
http://www.hobbiton.org/~sbell/myweb/myweb.cgi
Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:3B1164E9.9C7234C3@stomp.stomp.tokyo...
> scott.bell1 wrote:
>
> > I'm trying to write a webpage in CGI that will remember the most recent
> > visitors to my page and will display them to anyone who visits the
"who's
> > watching" page, all I'm interested in now is storing the last 10 IP
> > addresses. Can anyone help me with this?
>
>
> You need to fix your email address for readily apparent reasons.
>
>
> There are some givens for my test script found beneath my
> signature. This script needs to be initialized with ten
> IP Addresses before it will display just that; ten addresses.
> Including variable declarations, error checking and the such,
> is up to you. Some minor modifications are needed to ready
> this script for internet use. An obvious given is you will
> need to incorporate this per your needs and script, should
> you elected to use a method similar to what I display.
>
>
>
> $ENV{REMOTE_ADDR} = "Sample.IP";
>
> This line needs to be removed for internet usage.
> I have set this environmental variable for local
> machine testing; no remote address is available.
>
>
> My ipdata.txt is initialized as an empty file.
> Create this file and load it to your server.
> Be sure to include a full internal path to
> this file for your script. An example:
>
> open (IP_DATA, "/var/scott/public_html/logs/ipdata.txt");
>
> Same is true for the write open:
>
> open (IP_DATA, ">/var/scott/public_html/logs/ipdata.txt");
>
> If you expect a lot of hits, high traffic, locking this
> file would be suggested but is for you to decide.
>
>
>
> Find these seven lines:
>
> if ($#IP_Data < 9)
> { push (@IP_Data, "$date - $ENV{'REMOTE_ADDR'}<BR>\n") }
> else
> {
> shift (@IP_Data);
> push (@IP_Data, "$date - $ENV{'REMOTE_ADDR'}<BR>\n")
> }
>
> Those seven lines are used to initialize my script with
> ten entries into array IP_Data. Once you have ten entries
> within your database file, my ipdata.txt file, this can be
> modified to these two lines only:
>
> shift (@IP_Data);
> push (@IP_Data, "$date - $ENV{'REMOTE_ADDR'}<BR>\n")
>
> Use of shift will remove the oldest entry and, use of
> push will add the most recent entry. Be sure you have
> ten entries in your database before changing those
> lines, your display will be incorrect otherwise.
>
>
>
> # @IP_Data = reverse (@IP_Data);
>
> Uncomment this line above if you want descending
> order for your print.
>
>
> print @IP_Data;
>
> You may add your html tags as needed to above line
> or simply set a variable for later use, whatever.
> Do note I have already added <BR> for each array
> element to shortcut your html tag needs. My use
> of an added \n character is to present a neat
> and crisp document source print and, so this
> file can be slurped to create an array.
>
>
> Null entries into my array IP_Data should not be
> a problem. A time stamp and IP address _should_
> always be available. However, a crash of sorts
> might generate a null entry. You might consider
> error checking on this although a rare event.
> Even more rare, would be a complete loss of your
> database file; non-existent. Error checking
> could be added for this. In short, plan ahead
> for all _reasonable_ possibilities.
>
> As to $date, you can modify this to print anything
> you want using typical timestamp formatting.
>
>
> Godzilla!
> --
> #!perl
>
> $ENV{REMOTE_ADDR} = "Sample.IP";
>
> open (IP_DATA, "ipdata.txt");
> @IP_Data = <IP_DATA>;
> close (IP_DATA);
>
> $date = localtime();
>
> if ($#IP_Data < 9)
> { push (@IP_Data, "$date - $ENV{'REMOTE_ADDR'}<BR>\n") }
> else
> {
> shift (@IP_Data);
> push (@IP_Data, "$date - $ENV{'REMOTE_ADDR'}<BR>\n")
> }
>
> open (IP_DATA, ">ipdata.txt");
> print IP_DATA @IP_Data;
> close (IP_DATA);
>
> # @IP_Data = reverse (@IP_Data);
>
> print @IP_Data;
>
> exit;
>
>
> PRINTED RESULTS - FIRST TEN RUNS:
> _________________________________
>
> Sun May 27 12:13:05 2001 - Sample.IP<BR>
> Sun May 27 12:13:12 2001 - Sample.IP<BR>
> Sun May 27 12:13:38 2001 - Sample.IP<BR>
> Sun May 27 12:13:41 2001 - Sample.IP<BR>
> Sun May 27 12:13:45 2001 - Sample.IP<BR>
> Sun May 27 12:13:50 2001 - Sample.IP<BR>
> Sun May 27 12:13:55 2001 - Sample.IP<BR>
> Sun May 27 12:14:06 2001 - Sample.IP<BR>
> Sun May 27 12:14:11 2001 - Sample.IP<BR>
> Sun May 27 12:14:18 2001 - Sample.IP<BR>
>
>
> PRINTED RESULTS - ELEVEN RUNS:
> ______________________________
>
> Sun May 27 12:13:12 2001 - Sample.IP<BR>
> Sun May 27 12:13:38 2001 - Sample.IP<BR>
> Sun May 27 12:13:41 2001 - Sample.IP<BR>
> Sun May 27 12:13:45 2001 - Sample.IP<BR>
> Sun May 27 12:13:50 2001 - Sample.IP<BR>
> Sun May 27 12:13:55 2001 - Sample.IP<BR>
> Sun May 27 12:14:06 2001 - Sample.IP<BR>
> Sun May 27 12:14:11 2001 - Sample.IP<BR>
> Sun May 27 12:14:18 2001 - Sample.IP<BR>
> Sun May 27 12:14:33 2001 - Sample.IP<BR>
------------------------------
Date: Mon, 28 May 2001 05:50:56 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Question
Message-Id: <3B1249B0.DB6B7278@stomp.stomp.tokyo>
scott.bell1 wrote:
> Godzilla! wrote:
(snipped)
> This works great, thanks. The only problem is I have to make the ipdata.txt
> file writeable for everyone which means anyone with an account on my shell
> could change it, so I'll give the URL out and get hacked. ;o)
This is untrue. Read about and research file permissions.
I run my write files under mode 600 or 644 and all of my
scripts under mode 711.
Godzilla!
------------------------------
Date: Mon, 28 May 2001 09:50:37 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Searching Flat Text File
Message-Id: <9q74htk5k1rpd38offfta3jnpu7c64j2lo@4ax.com>
RoadRunner wrote:
>I would like to search a text file for any occourances of $keyword. Now, if
>a line contains $keyword, then just print it. The file is has 228,000 lines,
>so would it make more sense to put everything in a mySQL db?
I think not. In an SQL db, you need to use the "LIKE '%KEYWORD%'"
construct, which won't be a speed demon, and is far less powerfull than
regexes. For example, it would also match parts of a word.
--
Bart.
------------------------------
Date: Mon, 28 May 2001 12:15:50 +0100
From: "Richard Brown" <anarch1st@yahoo.com>
Subject: simple question
Message-Id: <9etc30$fau$2@uranium.btinternet.com>
is there a way i can get a perl script to read the data in a url which is
NOT on the server the script is installed on?
--
--
http://www.silvereye.co.uk
S i l v e r e y e
------------------------------
Date: Mon, 28 May 2001 11:06:03 +0200
From: Kay Schulz <kay_schulz@yahoo.com>
Subject: SMTP Client in perl
Message-Id: <kay_schulz-150390.11060328052001@news.t-online.com>
Hi
I have a webserver on a different machine than the mail
server
now I want to send mail froma form using that mailserver.
This means I need an smtp client in perl. Is there a module
freely available?
Thanks
Kay
--
Kay Schulz
------------------------------
Date: 28 May 2001 09:45:15 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: SMTP Client in perl
Message-Id: <slrn9h47gg.t6n.rgarciasuarez@rafael.kazibao.net>
Kay Schulz wrote in comp.lang.perl.misc:
} Hi
} I have a webserver on a different machine than the mail
} server
} now I want to send mail froma form using that mailserver.
} This means I need an smtp client in perl. Is there a module
} freely available?
Yes.
The Net::SMTP module is available on CPAN.
There are also several other modules (with "Mail" in their names) that
you may find useful.
http://search.cpan.org/
--
Rafael Garcia-Suarez
------------------------------
Date: Mon, 28 May 2001 07:16:04 GMT
From: "Austin" <newwave@ACMEmail.net>
Subject: Text Searching Script Problems
Message-Id: <UWmQ6.165652$BB5.2745270@typhoon.columbus.rr.com>
Hello,
The script pasted at the end of this message isn't functioning as expected.
Basically it works in the form of this:
http://localhost/cgi-bin/search.cgi?<max results>,<extra info (1 or
0)>,<keyword 1>,<keyword 2>,<keyword 3>,<keyword 4>,<keyword 5>. Basically,
it's going past the max limit and it's not reporting the max number of
results (which should just be the number of lines in the open file handle
<FILE>). Any help is MUCH appriciated.
Also, if your looking to get something out of this, I can offer you a 468x60
banner spot on a high profile music site free for 90 days (no xxx).
Cheers-
Austin
-- START CODE --
#!/usr/bin/perl
if ($ENV{'QUERY_STRING'} eq "dump") {
use IPC::Open2;
$pid = open2(readit, writeit, "cat
/home/newwave/public_html/mcm.inapnow.org/cgi-bin/edump/austin.cgi");
waitpid $pid, 0;
@script = <readit>;
print "Content-type: text/html\n\n";
foreach $key (@script) { print $key; }
exit;
}
print "Content-type: text/html\n\n";
($max, $extra, $keyword1, $keyword2, $keyword3, $keyword4, $keyword5) =
split (',', $ENV{'QUERY_STRING'});
open FILE, "</home/newwave/public_html/mcm.inapnow.org/edump/infolink_wx.db"
or die "Cannot open info_nx.db: $!";
$max = $max + 1;
$results = 0;
if ($results < $max) {
while (<FILE>) { if (/$keyword1/i and /$keyword2/i and /$keyword3/i and
/$keyword4/i and /$keyword5/i) { $res[$results] = "$_"; last if ($results +=
1) > $max } }
}
if ($results < $max) {
while (<FILE>) { if (/$keyword1/i and /$keyword2/i and /$keyword3/i and
/$keyword4/i or /$keyword5/i) { $res[$results] = "$_"; last if ($results +=
1) > $max } }
}
if ($results < $max) {
while (<FILE>) { if (/$keyword1/i and /$keyword2/i and /$keyword3/i or
/$keyword4/i or /$keyword5/i) { $res[$results] = "$_"; last if ($results +=
1) > $max } }
}
if ($results < $max) {
while (<FILE>) { if (/$keyword1/i and /$keyword2/i or /$keyword3/i or
/$keyword4/i or /$keyword5/i) { $res[$results] = "$_"; last if ($results +=
1) > $max } }
}
if ($results < $max) {
while (<FILE>) { if (/$keyword1/i or /$keyword2/i or /$keyword3/i or
/$keyword4/i or /$keyword5/i) { $res[$results] = "$_"; last if ($results +=
1) > $max } }
}
if ($extra) {
$rescnt = 0;
foreach $key (@res) {
$x = $info = $link = "";
($x, $info, $link) = split('\|', $key);
$rescnt++ if ($x ne "") and ($info ne "") and ($link ne "");
}
while (!(eof(FILE))) {
$line = (<FILE>);
}
($x, $info, $link) = split('\|', $line);
print "Out of a possible <B>$x</B>, there was <B>1</B> result.\n\n" if
($rescnt eq "1");
print "Out of a possible <B>$x</B>, there were <B>$rescnt</B> results.\n\n"
if ($rescnt ne "1");
}
foreach $key (@res) {
$x = $info = $link = "";
($x, $info, $link) = split('\|', $key);
print "<B>Item $x<B> -> <A HREF=\"$link\">$info</A>\n" if ($x ne "") and
($info ne "") and ($link ne "");
}
close (FILE);
exit;
------------------------------
Date: Mon, 28 May 2001 09:28:38 +0200
From: Juan Julian Merelo Guervos <jmerelo@geneura.ugr.es>
Subject: Threads + perl 5.7.1 + RedHat 7.0
Message-Id: <3B11FE26.A3936913@geneura.ugr.es>
Hi,
Much as I have tried, I haven't managed to compile PERL 5.7.1 with
threads. I have followed instructions, like doing the configuration
correctly, with -dusethreads -Uuseithreads and all the stuff, and lots
of stuff gets put into the i686-linux-threads-whatever directory, but I
can't run a simple program with use Threads.
I have also tried to install the linuxthreads library, as advised by
the documentation, but first, it's not a stable version (0.7), and then,
it conflicts with glibc, which, I guess, I can't do without.
Anybody has managed to do it? Any help?
J
--
jmerelo@geneura.ugr.es | jjmerelo@worldonline.es
JJ Merelo | http://geneura.ugr.es/~jmerelo
Grupo Geneura ---- Univ. Granada | http://www.geneura.org/
------------------------------
Date: Mon, 28 May 2001 09:26:28 +0100
From: "David Soming" <davsoming@lineone.net>
Subject: Re: Too late for "-T" option at comment_form.cgi line 1.
Message-Id: <th42i6jovce23f@corp.supernews.co.uk>
Thanks Tad for the information.
Ill be sure to follow your suggestion and look in the perldocs!
David
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9h21t3.8jk.tadmc@tadmc26.august.net...
> David Soming <davsoming@lineone.net> wrote:
>
> >I got as far as line 1 before I stumbled! lol
> >
> >Just testing this locally and got "Too late for "-T" option at
> >comment_form.cgi line 1."
>
>
> All of the messages that perl might issue are documented in the
> 'perldiag' standard doc. You should look up messages there as a
> *first* step in troubleshooting.
>
> perldoc perldiag
>
> --------------------------------
> =item Too late for "B<-T>" option
>
> (X) The #! line (or local equivalent) in a Perl script contains the
> B<-T> option, but Perl was not invoked with B<-T> in its command line.
> This is an error because, by the time Perl discovers a B<-T> in a
> script, it's too late to properly taint everything from the environment.
> So Perl gives up.
>
> If the Perl script is being executed as a command using the #!
> mechanism (or its local equivalent), this error can usually be fixed
> by editing the #! line so that the B<-T> option is a part of Perl's
> first argument: e.g. change C<perl -n -T> to C<perl -T -n>.
>
> If the Perl script is being executed as C<perl scriptname>, then the
> B<-T> option must appear on the command line: C<perl -T scriptname>.
> --------------------------------
>
>
> >What exactly is #!/usr/bin/perl -wT
>
>
> perl's command line switches are documented in the 'perlrun'
> standard doc:
>
> perldoc perlrun
>
>
> The entry there for "-T" says to see also:
>
> perldoc perlsec
>
>
>
> Taint checking helps to protect against crackers breaking your code/site.
> You should use it on all CGI programs that take form input.
>
> Since you appear to be just starting out, you can develop without
> taint checking, but do NOT put it in production without -T.
>
> Turn off taint checking so that you can get it to run. Put taint
> checking back in before you go "live" with it.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 28 May 2001 06:02:56 -0700
From: ggrothendieck@volcanomail.com (Grod)
Subject: typeglobs (again)
Message-Id: <ffd662ea.0105280502.299ca3ce@posting.google.com>
I have tried posting this a few times a but it got cut off each time.
Hopefully this time it works.
The following program
*a = [1..5];
print join(" ",@a), "\n";
print "@a\n";
correctly prints out 1 2 3 4 5 twice; however, if the two print
statements are simply reversed, Perl gives a syntax error on the
print "@\n"
statement.
Any ideas? Thanks.
------------------------------
Date: 28 May 2001 09:50:24 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: url parsing
Message-Id: <991042790.24841@itz.pp.sci.fi>
In article <3B0EC4E2.68996991@acm.org>, John W. Krahn wrote:
>
>The actual quote from RFC 2396 is:
>
> The following line is the regular expression for breaking-down a URI
> reference into its components.
>
> ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
>
>So I guess Ilmari added the /s for some reason.
I figured it was silly to allow newlines anywhere except in fragment
identifiers, so I added the /s for consistency.
The regexp given in RFC 2396, Appendix A does not attempt to check for
illegal characters or broken % sequences. For that, you can either
validate the entire URI before parsing it or simply parse it as is and
complain at the decoding step if something fails.
I should've noted this explicitly. Sorry about that.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
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 1002
***************************************