[10276] in Perl-Users-Digest
Perl-Users Digest, Issue: 3869 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 1 21:07:24 1998
Date: Thu, 1 Oct 98 18:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 1 Oct 1998 Volume: 8 Number: 3869
Today's topics:
Re: Can perl help me? <eashton@bbnplanet.com>
Re: Can perl help me? (Mads Toftum)
Re: Difference between =~ and =* operators? <aqumsieh@tigre.matrox.com>
Re: Hangs - Netscape Enterprise Server 3.51 / Sybase we scott_mcintosh@my-dejanews.com
Re: Hangs - Netscape Enterprise Server 3.51 / Sybase we (Adam Turoff)
Re: How do I do this c-ish pointerly thing in perl? (Tye McQueen)
Re: IDE for Perl ijliao@csie.nctu.edu.tw
Re: LDAP FTP authentication <imchat@imchat.com>
Re: linking perl modules to C (Ken Fox)
Multithreaded server in Win32 <vwstranathan@home.net>
Re: not parsing on first attempt <imchat@imchat.com>
Re: OO question: class data (Abigail)
Perl search engine problem <rickp@connect.ab.ca>
problem running perl script under apache server <fagneray@club-internet.fr>
Re: Problems Using a Compare Subroutine with Sort <willliams@clark.net>
Re: Problems Using a Compare Subroutine with Sort <willliams@clark.net>
Re: readdir in what order? (Tad McClellan)
Re: send geroge reese (was Re: Call for Participation: (Adam Turoff)
Trimming Long Scalar Variables <jesse@savalas.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 01 Oct 1998 22:03:09 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Can perl help me?
Message-Id: <3613F9A9.A6756472@bbnplanet.com>
Chad wrote:
> So, in essence, the user would send a request to the SSL web server, a
> cgi would contact the mainframe web server, the mainframe web server
> would send a response to the cgi, and the cgi would send the response
> back to the user's browser through the SSL. And all of this would be
> transparent to the end user's browser, it would think it was getting
> everything from the SSL web server.
I used to work in an academic environment that was full of ancient
mainframes. One of these was the student info. systems and registrar.
They wanted to make academic information available to the students via
the web in a secure fashion. Depending on your mainframe, what you
propose is probably possible but the solution that the registrar wanted
was to dump the database to a Sparc whereupon it was made available and
had the added advantage of not using the ever sacred main database. It
really all depends on what your availabilty demand is, your security
model and what your end goal is. If your mainframe runs perl and has a
database though, it's doable.
e.
Would I live my life over again?
Make the same unforgivable mistakes?
Yes, given half a chance. Yes -R. Carver-
------------------------------
Date: Thu, 01 Oct 1998 22:05:21 GMT
From: mt@dev.null (Mads Toftum)
Subject: Re: Can perl help me?
Message-Id: <3614fafd.3695601@news.inet.tele.dk>
On Thu, 01 Oct 1998 15:59:37 -0500, Chad <cdague@bigcat.fhsu.edu>
wrote:
>So, in essence, the user would send a request to the SSL web server, a
>cgi would contact the mainframe web server, the mainframe web server
>would send a response to the cgi, and the cgi would send the response
>back to the user's browser through the SSL. And all of this would be
>transparent to the end user's browser, it would think it was getting
>everything from the SSL web server.
Yep, this is definetely possible, but not necessarily very fast -
check http://www.linpro.no/lwp/ - a very nice perl lib that'll allow
you to do all sorts of HTTP stuff, and without having to do it all
from scratch.
>
>Or, if this will not work does anyone know of a product that you can sit
>in front of any web server and make it SSL?
>
Load up Apache with mod_ssl and mod_proxy - www.apache.org
vh
Mads Toftum, QDPH
som pe USENET reprfsenterer sig selv og ingen andre.
------------------------------
Date: 01 Oct 1998 19:17:07 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Difference between =~ and =* operators?
Message-Id: <x3yr9wrna8c.fsf@tigre.matrox.com>
ErikH@Bitsmart.com (Erik Huelsmann) writes:
>
>
> I am fairly new to perl, but I have extensively read the perlop pod
> and have not come to a conclusion about most of the regex operators.
> What are the differences?
Read perldoc perlre .. it's a good start .. but you probably would
like to start with a softer introduction. Check out Learning Perl, by
R. Schwartz and T. Christiansen.
>
> More specificly: what is the difference between the =3D~ operator and
> the =3D* operator? Both are said to influence the behavior of the s///
> operator, but how?
I have never seen =* used as a regexp operator. In fact, I have never
seen =* anywhere!! except when assigning globs, as in
*a=*b;
Such a beast does not exist. Where do you get your information from?
=~ simply tells the regexp engine which variable to act on.
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Thu, 01 Oct 1998 21:54:27 GMT
From: scott_mcintosh@my-dejanews.com
Subject: Re: Hangs - Netscape Enterprise Server 3.51 / Sybase web.sql 1.2 / Solaris 2.6
Message-Id: <6v0tmj$rgn$1@nnrp1.dejanews.com>
In article <3612844F.945CE85E@bbnplanet.com>,
Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> wrote:
> Scott McIntosh wrote:
>
> > Of course our big problem is that we don't have the source code for Sybase's
> > web.sql product in order to debug the problem. Has anyone encountered
similar
> > problems or have any suggestions?
>
> We have a client that has been wanting to use the web.sql application
> and we are having much the same problem as you are with it. Currently
> Sybase has one or two engineers trying to debug the problem for us. This
> may be totally unrelated to your problem but I would recommend calling
> technical support and send them that stack dump.
Actually they weren't interested in helping us because we were using
the wrong version of Solaris. i.e. they didn't want our to see
our stack. We've since fallen back to a much older configuration
(NS Commerce Server on Solaris 2.5.1), and things are a lot better.
But I wanted to make sure Sybase got some bad press -- perhaps it
will motivate them to support the latest Solaris OS. Thanks for your
comments nonetheless.
> P.S. How did Sybase and Solaris equal comp.lang.perl.misc?
Well, Sybase's wel.sql product uses Perl as the language and adds
features to muck the the database. So all web.sql programmers are also
Perl programmers. We're running everything on Solaris, and I suspect
it might be a light weight process problem in Solaris.
SM.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 1 Oct 1998 18:40:16 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Hangs - Netscape Enterprise Server 3.51 / Sybase web.sql 1.2 / Solaris 2.6
Message-Id: <6v10cg$3jp@panix.com>
<scott_mcintosh@my-dejanews.com> wrote:
> Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> wrote:
>> P.S. How did Sybase and Solaris equal comp.lang.perl.misc?
>
>Well, Sybase's wel.sql product uses Perl as the language and adds
>features to muck the the database. So all web.sql programmers are also
>Perl programmers. We're running everything on Solaris, and I suspect
>it might be a light weight process problem in Solaris.
Just what does web.sql do that promises to make your life easier than
using straight perl?
Would you rather pay Sybase to blow you off, or get your job done and
use DBI?
Z.
------------------------------
Date: 1 Oct 1998 17:23:18 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: How do I do this c-ish pointerly thing in perl?
Message-Id: <6v0vcm$2cl@fumnix.metronet.com>
jed@glug.hip.berkeley.edu (Jedediah D. Parsons) writes:
)
) What's a perl equivalent for this?:
)
) sub_p (char *a)
) {
) while (*a != '\0') do_something_with(a++);
) }
)
) In my case, *a points to a rather long string, so I want to avoid
) substr and arrays, if possible.
At first I though do_something_with() was working on a single
character at a time, in which case I'd use substr:
for( $i= 0; $i < length($a); $i++ ) {
do_something_with( substr($a,$i,1) );
}
But on second look I bet do_something_with() is wanting the string
except for the first C<$i> characters. Perl happens to have
optimizations for this type of thing so that I think the following
will be pretty fast:
while( "" ne $a ) {
do_something_with( $a );
substr($a,0,1)= "";
}
I _think_, the C<substr($a,0,1)= ""> will usually just increment
an internal offset into the buffer, rather than copy the whole
buffer contents down one byte each time [but I don't know for sure
whether Perl optimizes this case]. When the internal offset gets
"too big", Perl might decide to copy the buffer contents down and
reset the offset to 0, but it won't do that very often [if at all].
Since arguments to subroutines are references and substr() returns
an lvalue, the following:
while( "" ne $a ) {
do_something_with( substr($a,$i) );
}
might be even slightly more efficient. But you'd have to use C<$_[0]>
in C<sub do_something_with> in all of these cases or else Perl
will just copy the whole long string anyway and waste all of your
careful attempts to make the code that calls do_something_with()
efficient.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: 2 Oct 1998 00:32:16 GMT
From: ijliao@csie.nctu.edu.tw
Subject: Re: IDE for Perl
Message-Id: <6v16ug$l6b$1@netnews2.csie.nctu.edu.tw>
Jerry Henderson <jerrware@mwis.net> wrote:
> The closest thing I've seen to an IDE is PERL Builder by
> www.solutionsoft.com . Haven't seen anything with a class browser yet.
is there any IDE for un*x users ?
--
mailto:ijliao@csie.nctu.edu.tw?subject="send pgp key" to get my pgp public key
key finger print : FA 38 7E 91 FA 22 FA F6 63 04 E3 B5 A1 9F 0C CD
The International Obfuscated C Code Contest 1984 winner :
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
------------------------------
Date: Thu, 01 Oct 1998 17:24:33 -0500
From: "Mark P." <imchat@imchat.com>
To: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: LDAP FTP authentication
Message-Id: <36140120.2F3317B0@imchat.com>
PERLDAP doesn't qualify as Perl?
Tony Curtis wrote:
> Re: LDAP FTP authentication, Scott <shabicht@teksystems.com>
> said:
>
> Scott> Does anyone know of a way to authenticate FTP access
> Scott> against an LDAP. This would be done on an UNIX box
> Scott> running Solaris 3.5.1.
> ^^^^^^ really?
>
> I think you win today's "completely off-topic and unrelated
> to perl" award. Congrats!
>
> Scott> Content-Disposition: attachment; filename="vcard.vcf"
>
> Please don't post all this, it just eats up space.
>
> tony
> --
> Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
> Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
> "You see? You see? Your stupid minds! | private email:
> Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 1 Oct 1998 22:47:47 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: linking perl modules to C
Message-Id: <6v10qj$rci1@eccws1.dearborn.ford.com>
joost@dt.net writes:
> I have a problem with linking the perl module Socket.pm into
> my program which is used in the perl file I am starting from my
> C source.
Are you using DynaLoader? That should take care of all of your
linking problems -- you don't need to link the Socket module into
your program. Even building a static executable won't preclude
you from using dynamically loaded modules.
If you want the Socket module linked into your program statically
though, you must build a static version of the module. Once you
do that and install it, you should be able to link with it.
Why don't you try using DynaLoader and post your error messages
if that fails?
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: Fri, 02 Oct 1998 00:11:42 GMT
From: vwstranathan <vwstranathan@home.net>
Subject: Multithreaded server in Win32
Message-Id: <361418BD.2EE12A3B@home.net>
I'm working on a socket server that listens for connections on a
particular port, and I'd like to use the multithreaded variety - once a
connection is established on the "fake" port, fork and take care of the
client on the "real" port while the parent goes back to listening.
One problem - I'm trying this on Win32, so I have no fork(). Is there a
quick and dirty way to accomplish the same thing on Win32? This is the
example straight out of the Camel book.
So, the problem lines are about from line 27, to 43, where we try to
execute all this stuff in the child process. I'd like to try to do the
equivalent in Win32. Any ideas?
Will Stranathan
vwstranathan@home.net
1: ($port) = @ARGV;
2: $port = 2345 unless $port;
3:
4: $AF_INET = 2;
5: $SOCK_STREAM = 1;
6:
7: $sockaddr = 'S n a4 x8';
8:
9: ($name, $aliases, $proto) = getprotobyname('tcp');
10: if ($port !~ /^\d+$/) {
11: ($name, $aliases, $port) = getservbyport($port, 'tcp');
12: }
13:
14: print "Port = $port\n";
15:
16: $this = pack($sockaddr, $AF_INET, $port, "\0\0\0\0");
17:
18: select(NS); $| = 1; select(stdout);
19:
20: socket(S, $AF_INET, $SOCK_STREAM, $proto) || die "socket: $!";
21: bind(S,$this) || die "bind: $!";
22: listen(S,5) || die "connect: $!";
23:
24: select(S); $| = 1; select(stdout);
25:
26: for($con = 1; ; $con++) {
27: printf("Listening for connection %d....\n", $con);
28: ($addr = accept(NS,S)) || die $!;
29:
30: if (($child = fork()) == 0) {
31: print "accept ok\n";
32:
33: ($af,$port,$inetaddr) = unpack($sockaddr,$addr);
34: @inetaddr = unpack('C4',$inetaddr);
35: print "$con: $af $port @inetaddr\n";
36:
37: while (<NS>) {
38: print "$con: $_";
39: }
40:
41: close(NS);
42: exit;
43: }
44: close(NS);
45: }
------------------------------
Date: Thu, 01 Oct 1998 17:18:27 -0500
From: "Mark P." <imchat@imchat.com>
To: imchat@imchat.com
Subject: Re: not parsing on first attempt
Message-Id: <3613FFB2.2D63D75@imchat.com>
Hey thanks for all the help! I figured it out on my own.
Mark P. wrote:
> Hi, having a little trouble with a script not parsing a query sent along
> with the url to the script. The url is passing simple data to the script
> but cgi-lib.pl seems like its slow to parse out the data and add it. If
> I enter the url again everything works fine but the first attempt never
> works.This is one of my first scripts so don't be cruel. :-)
>
> The url sent is
> http://imchat.com/pub/secure.cgi?amount=5.00&invoice=10068&cust_id=166&name=Mark&lastname=Porter
>
> This script is just meant to add these items to another form. The name
> stuff doesn't matter but the invoice# and amount are critical. Here's
> the script.
> -----------------------------------------
> #!/usr/bin/perl
>
> require "cgi-lib.cgi";
> &ReadParse(*form_data);
>
> if ($form_data{'lastname'} ne "")
> {
> $lastname = $form_data{'lastname'};
> }
> else
> {
> $lastname = "";
> }
> if ($form_data{'name'} ne "")
> {
> $name = $form_data{'name'};
> }
> else
> {
> $name = "";
> }
> if ($form_data{'cust_id'} ne "")
> {
> $cust_id = $form_data{'cust_id'};
> }
> else
> {
> $cust_id = "";
> }
> if ($form_data{'invoice'} ne "")
> {
> $invoice = $form_data{'invoice'};
> }
> else
> {
> $invoice = "";
> }
> if ($form_data{'amount'} ne "")
> {
> $amount = $form_data{'amount'};
> }
> else
> {
> $amount = "";
> }
>
> print "Content-type: text/html\n\n";
> print "<html><head></head><body bgcolor=fffccc>";
> print "<center><h2><b>Please enter all data</b></h2></center>";
> print "<p><form name=secureform method=post value=secureform.cgi>";
> print "<TABLE WIDTH=100% BORDER=0 cellpadding=5>";
> print "<tr><td align=right>Customer Id :</td><td><input name=cust_id
> value=\"$cust_id\" size=6></td></tr><tr><td
> align=right>Invoice#:</td><td><input type=\"text\" size=10
> name=\"Invoice#\" value=\"$invoice\"><tr><td align=right>Amount
> : DM</td><td><input name=amount value=$amount
> size=8></td></tr><tr><td align=right>Name :</td><td><input
> type=\"text\" size=35 name=\"Name\" value=\"$name\"></td></tr><tr><td
> align=right>LastName:</td><td><input type=\"text\" size=35
> name=\"LastName\" value=\"$lastname\"></td></tr><tr><td
> align=right>Select</td><td><select
> name=\"CardType\"><option>KONTO<option>Visa<option>MasterCard<option>AmExCard<option>Discover<option>Diners
> Club</select></td></tr><tr><td align=right>KONTO #:</td><td><input
> name=\"KONTO\" size=\"18\" maxlength=\"19\"></tr><tr><td
> align=right>Card Number:</td><td><input name=\"CardNumber\" size=\"18\"
> maxlength=\"19\"></tr><tr><td align=right>Expires</td><td><select
> name=\"ExpMon\"><option value=\"1\" selected>1<option
> value=\"2\">2<option value=\"3\">3<option value=\"4\">4<option
> value=\"5\">5<option value=\"6\">6<option value=\"7\">7<option
> value=\"8\">8<option value=\"9\">9<option value=\"10\">10<option
> value=\"11\">11<option
> value=\"12\">12</select> Month <input name=\"ExpYear\"
> size=\"2\"
> maxlength=\"2\"> Year</td></tr></table></form><p><center><b>No
> Submit. This is a test form.</b></center></body></html>";
>
> exit;
------------------------------
Date: 1 Oct 1998 22:37:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: OO question: class data
Message-Id: <6v107p$9vs$1@client3.news.psi.net>
Phil Tomson (ptkwt@user2.teleport.com) wrote on MDCCCLVII September
MCMXCIII in <URL:news:6v0h4e$5tn$1@user2.teleport.com>:
++
++
++ I tried moving the 'my Census = 0' declaration to just after the package
^ You forgot a symbol here.
++ statement and got the same error message.
HTH. HAND.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: Thu, 01 Oct 1998 17:40:51 -0500
From: Rick Payne <rickp@connect.ab.ca>
Subject: Perl search engine problem
Message-Id: <361404F3.C08DA219@connect.ab.ca>
Please help with code problem there seems to be a forever loop
or something that is causing server overload.
Please email me if you find the problem.
Thanks,
RICK
Is's running at the folowing address; http://webtrawler.cjb.net
Here is the script.
__________________
#!/usr/local/bin/perl
###########################################################################
#
#
# websearcher.cgi - Perl Script for Searching Web
Sites #
#
#
# Written by Michael Hall -
mikeh@isaac.biola.edu #
# Written for Virtual Marketing Technologies -
vmt@airmail.net #
# Copyright )1996 by Virtual Marketing Technologies, All Rights
Reserved. #
#
#
###########################################################################
$MaxWords = 50;
$BaseDir = "/usr/www/eccentri/html/rickp/websearcher";
$BaseURL = "http://www.eccentrica.org/rickp/websearcher";
@Categories =
('Arts','Business','Computers','Education','Entertainment','Government','Health',
'Internet','News','Recreation','Reference','Regional','Science','Shopping','SocialScience','Society');
$FileFlag = 0;
$MatchFlag = 0;
$MatchFlag2 = 0;
$allow_html = 0;
&UnWeb;
$Header = <<'EOT';
<body bgcolor=#FFFFFF text=#000000>
<center>
<img src="http://www.eccentrica.org/rickp/websearcher/weblist.gif">
</center>
<center>
<body link="#0000FF" vlink="#0000FF" alink="#0000FF">
<p align="center"><a
href="http://www.eccentrica.org/rickp/websearcher/AddURL.html">Add
URL</a> <font color="#0000FF">/</font> <a
href="http://www.eccentrica.org/rickp/websearcher/index.html">Search</a>
<font
color="#0000FF">/</font> <a
href="http://www.eccentrica.org/rickp/websearcher/websearcher.cgi?random">Random
Link</a></p>
<form method=post action="websearcher.cgi">
<input type=hidden name="action" value="search">
<input type=text size=40 name="Keywords"> <input type=submit
value="Search!">
</center><p><hr><p></b>
EOT
$Footer = <<'EOT';
</body>
</html>
EOT
if ($ENV{'QUERY_STRING'} ne "") {
@TempCheck = split (/=/, $ENV{'QUERY_STRING'});
if ($TempCheck[0] eq "random") {
# Send the user to a random web site
srand ();
$NumCategories = @Categories;
while ($RandomMatch == 0) {
$randnum = int(rand($NumCategories));
if (-e "$BaseDir/$Categories[$randnum].dta") {
$RandomMatch = 1;
}
}
open (DB, "$BaseDir/$Categories[$randnum].dta");
@URL = <DB>;
close DB;
$NumSites = @URL;
$randnum2 = int(rand($NumSites));
@TempData = split (/&&/, $URL[$randnum2]);
print "Location: $TempData[1]\n\n";
}
$Category = $TempCheck[1];
# The user selected just a category from the search page
if (-e "$BaseDir/$Category.dta") {
open (DB, "$BaseDir/$Category.dta");
@Data = <DB>;
close DB;
&PrintHeader;
print "<html>\n <head>\n <title>Matches</title>\n </head>\n";
print "$Header\n";
print "The following entries matched your request:<p>\n";
print "<table border=2>\n";
print "<tr><td align=center><b>Title:</b></td><td
align=center><b>Description:</b></td></tr>\n";
foreach $Match (@Data) {
@TempData = split (/&&/, $Match);
print "<tr><td valign=\"top\"><a
href=\"$TempData[1]\">$TempData[0]</a></td><td
valign=\"top\">$TempData[2]</td></tr>\n";
}
print "</table><p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
else {
&PrintHeader;
print "<html>\n <head>\n <title>Matches</title>\n </head>\n";
print "$Header\n";
print "We're sorry, there are currently no entries in this
category.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
}
if ($in{'action'} eq "add") {
# Add a URL to the database
# Check to make sure everything was entered correctly
if (($in{'Title'} eq "") || ($in{'URL'} eq "") || ($in{'Category'} eq
"") || ($in{'Description'} eq "")) {
# Something was left blank
&PrintHeader;
print "<html>\n <head>\n <title>Error: Blank Entry</title>\n
</head>\n";
print "$Header\n";
print "You did not enter in all the information requested. Please go
back and make sure everything is filled in.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
# Check to see that the URL is valid
$CheckURL = substr ($in{'URL'}, 0, 7);
if ($CheckURL ne "http://") {
&PrintHeader;
print "<html>\n <head>\n <title>Error: URL Invalid</title>\n
</head>\n";
print "$Header\n";
print "The URL you entered seems to be invalid. It should start with
\"<b>http://</b>\". Please go back and check your url.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
# Now check to see if the description is too long
@DescArray = split (/ /, $in{'Description'});
$ArrayCount = @DescArray;
if ($ArrayCount > $MaxWords) {
&PrintHeader;
print "<html>\n <head>\n <title>Error: Description Too Long</title>\n
</head>\n";
print "$Header\n";
print "Your description contains $ArrayCount words. The maximum
number of words it can contain is $MaxWords. Please go back and edit
your description.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
# Now check to see if it is a valid category
foreach $Category (@Categories) {
if ($Category eq "$in{'Category'}") {
$CatFlag = 1;
}
}
if ($CatFlag != 1) { # An invalid category
&PrintHeader;
print "<html>\n <head>\n <title>Error: Invalid Category</title>\n
</head>\n";
print "$Header\n";
print "You have attempted to post a new entry to an invalid category.
Please go back and try again.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
# Now write the information to the appropriate file
$in{'Description'} =~ s/[ \n\t\r\f]/ /go;
if (-e "$BaseDir/$in{'Category'}.dta") {
open (DB, ">>$BaseDir/$in{'Category'}.dta");
print DB "$in{'Title'}&&$in{'URL'}&&$in{'Description'}\n";
close DB;
}
else {
open (DB, ">$BaseDir/$in{'Category'}.dta");
print DB "$in{'Title'}&&$in{'URL'}&&$in{'Description'}\n";
close DB;
}
# Now present the information to the user
&PrintHeader;
print "<html>\n <head>\n <title>URL Added</title>\n </head>\n";
print "$Header\n";
print "Thank you for your information. Your URL has been added to the
system and can now be searched from the search page.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
if ($in{'action'} eq "search") {
# Search the databases for any web sites that match the keywords
entered
$Counter = 0;
foreach $Category (@Categories) {
if (-e "$BaseDir/$Category.dta") {
open (DB, "$BaseDir/$Category.dta");
$FileFlag = 0;
@KeyData = <DB>;
foreach $TempLine (@KeyData) {
@Keywords = split (/ /, $in{'Keywords'});
foreach $Keyword (@Keywords) {
if (($TempLine =~ /$Keyword/i) && ($MatchFlag2 == 0)) {
$MatchFlag = 1;
$MatchFlag2 = 1;
$URL[$Counter] = $TempLine;
$Counter++;
}
}
$MatchFlag2 = 0;
}
$FileFlag = 0;
$MatchFlag2 = 0;
}
}
if ($MatchFlag == 0) {
# No matches were found
&PrintHeader;
print "<html>\n <head>\n <title>No Matches Found</title>\n </head>\n";
print "$Header\n";
print "No entries were found that matched your keywords. Please go
back and try again.<p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
else {
&PrintHeader;
print "<html>\n <head>\n <title>Matches</title>\n </head>\n";
print "$Header\n";
print "The following entries matched your request:<p>\n";
print "<table border=2>\n";
print "<tr><td align=center><b>Title:</b></td><td
align=center><b>Description:</b></td></tr>\n";
foreach $Match (@URL) {
@TempData = split (/&&/, $Match);
print "<tr><td><a
href=\"$TempData[1]\">$TempData[0]</a></td><td>$TempData[2]</td></tr>\n";
}
print "</table><p>\n";
print "Newfoundland WebTrawler.<br>\n";
print "$Footer\n";
exit;
}
}
#######################
# Parse Form Subroutine
sub UnWeb {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}
else {
unless ($name eq 'body') {
$value =~ s/<([^>]|\n)*>//g;
}
}
$in{$name} = $value;
}
}
#######################
# Print HTML Header
sub PrintHeader {
print "Content-type: text/html\n\n";
}
------------------------------
Date: 1 Oct 1998 22:21:08 GMT
From: "frederic agneray" <fagneray@club-internet.fr>
Subject: problem running perl script under apache server
Message-Id: <01bded8a$15db3840$6c729ec2@harrykal>
I try to execute Perl script on an apache server running above linux OS.
I succed in my trying to execute perl on the console, with the line
$ perl test.cgi
I did not forget the beginning of the script -> content...
I succed to execute C cgi script on my browser.
in my httpd.conf file I've only put
ScriptAlias /cgi-bin /var/lib/httpd/cgi-bin
I've forget something but i don't know what ?
nothing is working and it's make me sick.
------------------------------
Date: Thu, 1 Oct 1998 19:10:04 -0400
From: "Joe Williams" <willliams@clark.net>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <6v124t$hl7$1@clarknet.clark.net>
Jonathan - The strings arn't sorted in the correct order and they are
truncated.
The problem seems to be that I am using substr to clip the dotted quad IP
address out of the strings that I want to sort, and I'm doing this in the
comparison subroutine. This definately is one of the problems. Sort passes
the input to the subroutine as the referenced variables $a and $b, and
substring applied to these variables doesn't work. I may try dereferencing
the variables, e.g., $a_temp = $$a, to see if that helps.
Jonathan Feinberg wrote in message ...
>"Joe Williams" <willliams@clark.net> writes:
>
>> However, I'm not getting good results
>
>Nowhere do you say what you mean by "not getting good results". Do you
>mean your machine is crashing? What? Could you provide some brief but
>complete sample code that demonstrates the problem you're having?
>
>> Does anyone know a safe way to write a comparison subroutine that
>> does some processing on the strings that are passed?
>
>If you're potentially changing the comparison order of any two members
>of the list being sorted, then that's a definite no-no, as documented
>in perlfunc.
>
>--
>Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
>http://pobox.com/~jdf
------------------------------
Date: Thu, 1 Oct 1998 19:12:30 -0400
From: "Joe Williams" <willliams@clark.net>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <6v128d$hr1$1@clarknet.clark.net>
John - I will give it a try, thanks. Joe
John Porter wrote in message <3613C75B.E0302FE2@min.net>...
>Michal Rutka wrote:
>>
>> Hymm, just tell what results you are getting and why do you think
>> they are wrong. Then I tell you why John's clever routine is not so
>> clever.
>
>Hey, I never made any claims about how clever my code was.
>But I'll tell you this: my dotted_to_int() subroutine is more
>correct -- although a lot slower -- than your pack/split method.
>
>
>> Hint - you are loohing for bug in a wrong place. After you spot a
>> bug, you can tell John how much time did it cost you. He should be
>> proud.
>
>You've got a monstrous chip on your shoulder, droog.
>
>
>> Yes. Just try this:
>>
>> @ips_sorted = sort {
>> pack("C4",split(/\./,$a)) cmp pack("C4",split(/\./,$b))
>> } @ips;
>
>Or try this, which is more correct:
>
> @ips_sorted = sort {
> inet_aton($a) cmp inet_aton($b)
> } @ips;
>
>--
>John "Many Jars" Porter
>baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: Thu, 1 Oct 1998 19:31:07 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: readdir in what order?
Message-Id: <bs61v6.ntc.ln@flash.net>
Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote:
: In article <3613BD34.B1BBB3C@shell.com>, yong <yong@shell.com> wrote:
[snip]
: >($myfile)=grep /.*?\.txt/, readdir TMP;
[snip]
: >Initially I thought readdir picks the first file according to "sort by
: >name", but it doesn't look like so.
: readdir returns file names in whatever order the underlying file system
: supplies them (which is typically no order at all). If you want a sorted
: list, you have to do it yourself:
: opendir(DIRECTORY, ".") || die "Can't open directory: $!\n";
: @textfiles = sort grep { /\.txt$/ } readdir DIRECTORY;
: closedir(DIRECTORY);
Or, if you want only the first one in a scalar variable:
$textfile = (sort grep { /\.txt$/ } readdir DIRECTORY)[0];
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 1 Oct 1998 18:48:09 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: send geroge reese (was Re: Call for Participation: Python Conference)
Message-Id: <6v10r9$3ss@panix.com>
Larry Wall <larry@kiev.wall.org> wrote:
>John Porter <jdporter@min.net> wrote:
>>Zenin wrote:
>>Personally, I think we all -- and some of us more than others --
>>could stand to take in an ML conference or two.
>
>Well, I went to an XML conference. Does that count? :-)
Only if X matches 0 or more characters. :-)
Z.
------------------------------
Date: Fri, 02 Oct 1998 00:37:43 GMT
From: Jesse Rosenberger <jesse@savalas.com>
Subject: Trimming Long Scalar Variables
Message-Id: <36142059.8904AF28@savalas.com>
Hey everyone,
How would you get Perl to trim a long variable value down to a
certain specified length?
Example:
$variable = "supercalafragalisticexpealidocious";
I want to have the option to take the first, let's say, 20 characters,
and have the variable become:
$variable = "supercalafragalistic"; and drop the rest....
Anyone know how I can do this?
-Jesse Rosenberger
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3869
**************************************