[13552] in Perl-Users-Digest
Perl-Users Digest, Issue: 962 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 1 08:07:08 1999
Date: Fri, 1 Oct 1999 05:05:12 -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: <938779512-v9-i962@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 1 Oct 1999 Volume: 9 Number: 962
Today's topics:
Re: Best way to check a user's input? (Abigail)
Re: Can perl create an excel file (Abigail)
Re: CGI call CGI? (Paul Workman)
Re: CGI call CGI? <bg25@mailexcite.com>
Re: Dealing with "MS-ASCII" - again! (yes, I know it is <pez68@my-deja.com>
fork and segmentation fault frodefi@my-deja.com
Re: HTML, perl/cgi. (Abigail)
MAC Portability Issues zarraar@my-deja.com
Re: MAC Portability Issues <gellyfish@gellyfish.com>
Re: MAC Portability Issues (Chris Nandor)
Re: Perl Debugger <cseeberg@sgi1.chemie.uni-hamburg.de>
Re: perlxstut: Example 1 (Arved Sandstrom)
Re: ping script to page mobile... (Abigail)
Really difficult (or primitive?) problem? <pkotala@logis.cz>
Re: RegEx for html->plain text (Abigail)
Re: Server emulation offline <gellyfish@gellyfish.com>
Re: setpwent (Abigail)
Re: Sorting weird numeric data (Abigail)
Re: Trouble with matching. Help appreciated. (I.J. Garlick)
Re: Upload problem w/ Apache/Linux/CGI.pm <gellyfish@gellyfish.com>
Re: Using multiple query strings (I.J. Garlick)
Re: Using SS Numbers as DBM Index: Best Way to Encrypt (Abigail)
Re: Validating email addresses. (Chris Nandor)
Re: why use references - in laymans terms? (Anno Siegel)
Re: Win32, Is there a way to associate the PID and it's <carvdawg@patriot.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Oct 1999 04:59:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Best way to check a user's input?
Message-Id: <slrn7v9200.8i.abigail@alexandra.delanet.com>
Keith Lee (leejk@cat.com) wrote on MMCCXXI September MCMXCIII in
<URL:news:7t0fp1$f8$1@ns1.cat.com>:
'' I want to validate a user's input. The input can only be a number between
'' 0.8 and 2.3. Using a simple pattern match does not seem to work well with
'' the decimals.
'' unless ($a =~ /[0.8-2.3]/) {
'' do this;
'' }
'' Can any of you pattern matching wizards suggest something, or a good book on
'' pattern matching?
Uhm, uhm, why a regex if you're comparing numbers?
if (0.8 <= $a && $a <= 2.3)
Now, if $a can be anything, do something like:
if ($a !~ /[^\d.]/ && $a =~ y/././ < 2 && 0.8 <= $a && $a <= 2.3)
But if you really insist on a regex:
if ($a =~
/^0*(?:(?:\.[89]\d*)|(?:1(?:\.\d*)?)|(?:2(?:\.(?:[012]\d*|30*)?)?))$/)
I didn't test it though, so it's likely to contain bugs.
Abigail
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Oct 1999 05:00:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Can perl create an excel file
Message-Id: <slrn7v9210.8i.abigail@alexandra.delanet.com>
HillFam2 (hillfam2@aol.com) wrote on MMCCXXII September MCMXCIII in
<URL:news:19991001011248.24361.00000368@ng-fb1.aol.com>:
%% Can I create an excel file from perl
Yes.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 01 Oct 1999 11:02:02 GMT
From: paulcw@best.com (Paul Workman)
Subject: Re: CGI call CGI?
Message-Id: <37f494aa$0$203@nntp1.ba.best.com>
In article <HxnzN=XzdRVYNJ72u7FHa5xC9D8w@4ax.com>,
Bangert Goldsmith <bg25@mailexcite.com> wrote:
>Hi
>
> How can I call an CGI script from another CGI script, both in Perl?
What are you trying to do? Apart from the fine suggestions already made,
it sounds like conceivably "require" is what you're looking for.
Or not.
--Paul
------------------------------
Date: Fri, 01 Oct 1999 14:08:50 +0200
From: Bangert Goldsmith <bg25@mailexcite.com>
Subject: Re: CGI call CGI?
Message-Id: <BqH0N0nAJ8Ex9v9JCnYS0wOlG2HV@4ax.com>
On 01 Oct 1999 11:02:02 GMT, paulcw@best.com (Paul Workman) wrote:
>In article <HxnzN=XzdRVYNJ72u7FHa5xC9D8w@4ax.com>,
>Bangert Goldsmith <bg25@mailexcite.com> wrote:
>>Hi
>>
>> How can I call an CGI script from another CGI script, both in Perl?
>
>What are you trying to do? Apart from the fine suggestions already made,
>it sounds like conceivably "require" is what you're looking for.
>
>Or not.
>
>--Paul
>
I can't see any suggestions except yours. Well, a long story! In
short: because of using Java to call a webpage in CGI, I can not use
HTTP_REFERER. Then I try to fix the problem by using parameters (to
the CGI script) instead. I have figured it out with very simple
solution.
$myfile= "actualcgifile.cgi";
exec($myfile);
But my problem is still not solved yet! I don't know how to put
parameter to the CGI in the form:
http://.........../somefile.cgi/god/helpme?give_me_something_to_eat_etc.
This is easy with an html link, but CGI!
Thanks for your attention
- BG
------------------------------
Date: Fri, 01 Oct 1999 11:43:28 GMT
From: PEZ <pez68@my-deja.com>
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <7t26ou$ot8$1@nnrp1.deja.com>
In article <7st0m7$1uh$1@yin.interaccess.com>,
gazelle@interaccess.com wrote:
> In article <7ssbrr$ghk$1@nnrp1.deja.com>, PEZ <pez68@my-deja.com>
wrote:
> >In article <7sr0ip$jt2$1@yin.interaccess.com>,
> > gazelle@interaccess.com wrote:
> >> A few months ago, I posted about the problem of dealing with text
> >>posted to the net from silly word processors like MS Word and so on
> >>that have non-ASCII characters in them ("non-ASCII" meaning
characters
> >>whose code is >= 128)
> >
> >
> >I'm not sure I understand what you mean with "deal" with these files.
> >Do you want to convert them down to 7-bit? If so, I must ask why? In
> >any case it's not all that straight forward to do the conversion. For
> >instance take the Swedish extra three letters å (a-ring), ä (a-
umlaut)
> >and ö (o-umlaut). (Yes, those are letters and not just accented
> >variants on a and o.) One way to deal with those are to strip off the
> >rings and dots (umlauts), an assault on the Swedish language. But on
7-
> >bit systems of old those have been replaced by the ASCII chars [, ],
\,
> >{, } and |. Terminals and programs reading files like those converted
> >them back so that we Swedes can still see our dear extra letters. But
> >you can imagine how source code looks on those terminals....
>
> Yes, the goal is to render them 7-bit clean. The goal is not to
offend
> non-American-English readers/speakers. The goal *is* to offend users
of
> MS-Word, who do not know how to properly export their text for
posting to
> the Usenet.
=) I never thought you were out to offend us! But while we are at it
the goal definition. What is the original problem? Can you show me a
posting that needs this processing? Maybe I can think of a way to deal
with it if I know what the problem is about.
> Now, I think I may have gotten myself confused about which is the
proper
> "code page" to be concerned with. Is it 850 or is it 1252 - that is
the one
> that explains the funny characters [mostly quote marks] that show up
in
> poorly exported MS Word documents?
Hmmm. No, it was me that translated MS-ASCII to CP-850. MS Word did
show up on the DOS platform first though, so maybe some Word documents
can have CP 850 coding...
> I had gotten the idea from the previous thread that it was 1252, but
> when I looked at and edited the 1252 page (and posted to the ng, in
the
> previous post), it seemed to have a lot more foreign language
constructs
> that I think it should have.
How so? Can you tell me what you would think was a proper amount? I
have dealt some with documents needing to be translated to 27 languages
so maybe I can shed some light on it or just agree with you that it
seems to be too many constructs.
> Also, I tried the "7-bit approximation" feature of lynx - all that
seems to
> do is remove the funny characters. I'd rather do better than that.
I do have a gut feeling that this is a job where you would want SCO
trchan! Maybe some GNU-ish dude has written one?
/Peter
--
-= Spam safe(?) e-mail address: pez68 at netscape.net =-
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Oct 1999 09:46:00 GMT
From: frodefi@my-deja.com
Subject: fork and segmentation fault
Message-Id: <7t1vsm$khh$1@nnrp1.deja.com>
I am trying to make a program which is to go through each line of a
large file and do a special check on the line. Normally this check on a
line is done quickly, but some times it can take a while. To prevent
the program to "hang" on these difficult lines, I thought I would try
forking the checking-part.
I wrote a small test-program, but it failes after a minute or two:
>./test.pl
Attempt to free unreferenced scalar at ./test.pl line 27, <F> chunk
2214.
Attempt to free unreferenced scalar at ./test.pl line 33, <F> chunk
2214.
Segmentation fault (core dumped)
What could be wrong? The test-code (see below) is run under Red Hat
Linux 5.2 (or something close).
Thank you for your help!
Regards,
Frode
The test-code is as follows:
#!/usr/bin/perl
#
# test.pl
#
# Go through each line in a file with a few hundred thousands lines.
# For each line perform a check. Because this check may once in a
# while take time, perform the check as a child process, so that
# the other lines can be checked simultaneously.
#
$| = 1;
use strict;
my $max_processes = 50;
my $line = "";
open(FILE,"lines.txt") or die $!;
while ($line = <FILE>) {
chop($line);
# One of the things to check on each line requires
# a query on the internet. In case this query takes
# a while I will limit the number of processes of
# this program running simultaneously. But how many
# open connections to the internet can I safely have?
# And is there a better way to limit the number
# of processes?
my $processes = 0;
do {
$processes = `ps aux | grep -c test`;
chop($processes);
sleep 5 if ($processes > $max_processes);
} while ($processes > $max_processes);
FORK: {
if (my $pid = fork) {
# parent process:
# There is not much to do here, but I realized
# the line of code below was necessary to
# avoid "zombies"
$SIG{CHLD} = sub { wait };
} elsif (defined $pid) {
# child process:
# Do the wanted checking
✓
# Finish "child"
exit;
} elsif ($! =~ /No more process/) {
sleep 5;
redo FORK;
} else {
die "Can't fork: $!\n";
}
}
}
close(FILE);
sub check {
# Does no checking now, before I can get this "fork"
# to work properly...
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 1 Oct 1999 05:07:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: HTML, perl/cgi.
Message-Id: <slrn7v92f7.8i.abigail@alexandra.delanet.com>
Danny Verkade (webmaster@mybegin.com) wrote on MMCCXXI September MCMXCIII
in <URL:news:37F3E16A.7BB0D9F9@mybegin.com>:
,,
,, I have an XML document where a CGI/perl program need some information
,, from. The XML file is loaded into one string ($content). Unfortunately I
,, cannot add new modules to the server and I do not have te XML module
,, installed on it. This is what the XML document looks like
Did you read the faq about installing modules? You don't need more
access for installing a module then for installing another kind of
file. If you can put your program on a machine, you can put your
module there as well.
,, <channel>
,, <image>
,, <link>Waar linken we naar??</link>
,, <url>Plaats van het plaatje
,, </image>
Closing tag of element IMAGE encountered, but current open element
is URL. Reboot universe [Y/Y/Abort] ?
,, <item>
,, <link>Hier linken we naar</link>
,, <title>Titel van de link</title>
,, <description>Meer info over de link</description>
,, </item>
,, </channel>
,,
,, Hope you can help.
Well...., what exactly is your question?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 01 Oct 1999 11:15:49 GMT
From: zarraar@my-deja.com
Subject: MAC Portability Issues
Message-Id: <7t254v$nr7$1@nnrp1.deja.com>
I am having problems running some Perl generated HTML pages on Mac
Communicator browsers whilst others work fine. However all of these
work fine on PC based browsers.
Does anyone have any ideas of what the problem could be?
cheers,
Z
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 1 Oct 1999 12:38:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: MAC Portability Issues
Message-Id: <37f49d4e_1@newsread3.dircon.co.uk>
zarraar@my-deja.com wrote:
>
>
> I am having problems running some Perl generated HTML pages on Mac
> Communicator browsers whilst others work fine. However all of these
> work fine on PC based browsers.
>
I would ask in a newsgroup that is interested in HTML or browsers - the
difference between various browsers behaviour when faced with some HTML
*however* it was generated is not a topic for this group.
/J\
--
"I'm not Carol Vorderman - you wouldn't see me getting drunk in a kebab
shop" - Lily Savage
------------------------------
Date: Fri, 01 Oct 1999 11:47:32 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MAC Portability Issues
Message-Id: <pudge-0110990747390001@192.168.0.77>
In article <7t254v$nr7$1@nnrp1.deja.com>, zarraar@my-deja.com wrote:
# I am having problems running some Perl generated HTML pages on Mac
# Communicator browsers whilst others work fine. However all of these
# work fine on PC based browsers.
#
# Does anyone have any ideas of what the problem could be?
No. Go to a newsgroup that has something to do with the web or Netscape
Communicator.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 01 Oct 1999 11:51:16 +0200
From: Christian Seeberger <cseeberg@sgi1.chemie.uni-hamburg.de>
Subject: Re: Perl Debugger
Message-Id: <37F48414.AAA15718@sgi1.chemie.uni-hamburg.de>
Martin zur Heiden wrote:
>
> Is there any Perl-Debugger, where a breakpoint can be set before
> execution of the script?
Perls build-in debugger should do. To start it: 'perl -d yourscript'.
Within the debugger 'b' sets a breakpoint on the current line. 'h' gives
you help within the debugger, 'man perldebug' is helpful too
Good Luck with this
--
Christian Seeberger
cseeberg@sgi1.chemie.uni-hamburg.de
------------------------------
Date: Fri, 01 Oct 1999 06:51:48 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: perlxstut: Example 1
Message-Id: <Arved_37-0110990651480001@dyip-55.chebucto.ns.ca>
In article <pbyadplmdk.fsf@srv-deu-cos11.baan.com>, jmfelder@baan.com
(Jens M. Felderhoff) wrote:
> The (first) line the compiler was complaining about is:
>
> PROTOTYPES: DISABLE
>
> in Mytest.xs which also appears in the C source file.
>
The xsubpp command-line options that correspond to the PROTOTYPES
directive are -prototypes and -noprototypes. Try taking the PROTOTYPES
directive out of the XS, and set the option by entering it in as the
$XSPROTOARGS (from memory) key-value pair to MakeMaker in your Makefile.PL
file.
HTH, Arved
------------------------------
Date: 1 Oct 1999 04:41:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: ping script to page mobile...
Message-Id: <slrn7v90tr.8i.abigail@alexandra.delanet.com>
jakal (jakem@camtech.net.au) wrote on MMCCXXII September MCMXCIII in
<URL:news:jakem-0110991124340001@dialup-sa-1-475.uni.camtech.net.au>:
'' Has anyone written a Perl script that will ping a server, any page a
'' mobile if the server is down?
Sort of, but instead of ping, I would try connecting to a Sybase server.
The idea is simple. You try to connect to a server, and set a reasonable
time out. If it succeeds, then you're fine. Else, you compose an error
message, and send it. When using a pager with an email address, all what
was needed was opening a pipe to /bin/mailx and some print statements.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 1 Oct 1999 13:53:24 +0200
From: "Pavel Kotala" <pkotala@logis.cz>
Subject: Really difficult (or primitive?) problem?
Message-Id: <938778821.149049@gate.logis.cz>
I have asked about problem below, but I have not received any answer. Is it
problem that has no solution or is it so primitive that no expert can waste
his time?
Is there any way to set timeout for listening on TCP/IP (script should be
run on either unix and win32)?
I would like to listen on some port and if I would not get message in some
time, I would need to stop listening and return from procedure.
Thank very very much for any help (if exists any)
Pavel Kotala
------------------------------
Date: 1 Oct 1999 04:44:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: RegEx for html->plain text
Message-Id: <slrn7v912u.8i.abigail@alexandra.delanet.com>
Sushant Gargya (sushant@ntwrks.com) wrote on MMCCXXI September MCMXCIII
in <URL:news:37F3CFBA.34BDE75D@ntwrks.com>:
-- Looking for "parser" that would take an html input file and
-- output the file without the html tags encountered. In other words,
-- need a converter that converts html file to plain text file.
Well, what you want is rather trivial. However, the subject implies
something else, which makes the exercise a lot more complicated.
Why do you want a regex?
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Oct 1999 10:33:19 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Server emulation offline
Message-Id: <37f47fdf_1@newsread3.dircon.co.uk>
Matt & Michelle <mattmich@idirect.com> wrote:
> Hi, I am a brand new newbie.
>
> I would like to beable to run my cgi/perl programs offline when working on
> my webpage. I need to know what to install to get my computer to run my
> offline webpage as if it were running off a server. I have installed
> Standard Perl 5.004.
>
Get Perl 5.005 for Win32 from <http://www.activestate.com>
Ask in the group comp.infosystems.www.servers.ms-windows for recommendations
and information for configuring a suitable HTTP server to sun on your
system.
/J\
--
"I don't have access to the intelligence" - Michael Howard
------------------------------
Date: 1 Oct 1999 04:18:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: setpwent
Message-Id: <slrn7v8vib.8i.abigail@alexandra.delanet.com>
Martien Verbruggen (mgjv@comdyn.com.au) wrote on MMCCXXII September
MCMXCIII in <URL:news:vQVI3.130$Fy1.5807@nsw.nnrp.telstra.net>:
||
|| Setting fields in passwd strings is a very system and configuration
|| dependent thing (yp, NIS, shadow), and therefore hard to express in a
|| general API. AFAIK you will need to use OS specific tools.
vi seems to be on any platform with a /etc/passwd file.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Oct 1999 04:11:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Sorting weird numeric data
Message-Id: <slrn7v8v6q.8i.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCXXII September MCMXCIII in
<URL:news:x7yadntzkc.fsf@home.sysarch.com>:
??
??
?? it is easy to check for max perl sort size. just make a sort sub for you
?? records and sort 10, 100, 1000, .... 10eN records until the benchmarks
?? jump off the page. that last sort is too big for an in memory perl
?? sort. you can fine tune that if you wish to get a more accurate
?? number. use some value that is lower than the max you calculate to
?? determine if you sort in memory or externally. just from my benchmarks,
?? on a 128MB ultrasparc ii, i would thrash on 100k records of 100
?? bytes. that is only 10MB of data but you have to count perl data
?? overhead which is not cheap. also there were xwindows and other things
?? running. if this is a web server, you won't/shouldn't have windows
?? sucking up ram. but you may/will have lots of cgi processes forking out
?? all over.
If I were to write/maintain a CGI program and I find myself sorting 100k
records on each invocation of the program, I would not start benchmarking
to see whether it's time to use /bin/sort or not.
I would spend my time in redesigning the program such that it doesn't
have to sort 100k records each time. Keeping your data sorted is an
obvious candidate.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 1 Oct 1999 11:45:28 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Trouble with matching. Help appreciated.
Message-Id: <FIx9zs.6yu@csc.liv.ac.uk>
In article <Lc4I3.2034$tQ4.6297@dummy.bahnhof.se>,
"Par Svensson" <par@removethis.bahnhof.se> writes:
> Hello.
>
> I have a lot of infiles looking like:
>
> <a>
> data
> </a>
> <b>
> data
> </b>
> <c>
> data
> </c>
>
> etc. Not all tags are present in all files. I want to process the data
> differently
> depending on which tags they're inside. I use
Errr... I may be miles off here but wouldn't it be better to read the file
line by line and do one of three things per line?
Eg if it's a <*> line set a flag with string inside the < > brackets.
Then for each line that isn't </flaged value> store the values in a hash
keyed on the flag value.
This way you get a hash containnig the data for each tag, the tags can be
anything, and a simple exists $tag{'c'} would tell you if any data in the
c tag was present.
It also alows you to deal with data in tag c before tag a because you
sorted it when reading in.
To solve your match problem you may want to read up on what the s operator
does for matches involving . and were new lines can be present, for a start.
Personally though if your data is exactly as you say I would try the
method I outlined.
--
Ian J. Garlick
ijg@csc.liv.ac.uk
"Our vision is to speed up time, eventually eliminating it."
-- Alex Schure
------------------------------
Date: 1 Oct 1999 10:39:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Upload problem w/ Apache/Linux/CGI.pm
Message-Id: <37f48145_1@newsread3.dircon.co.uk>
j_v_schmitt@my-deja.com wrote:
> My simple form handler dies ("Premature end of script headers" shows
> up in the log file) when I DON'T specify a file to upload.
>
> If I do specify a file to upload, then the form handler passes by fine,
> and will display "Hello there".
>
> I'm running Apache 1.3.6 on Redhat Linux 6.0, and have installed CGI.pm
> This worked fine on my Unix/Netscape server, but fails on the
> Linux/apache.
>
> Here's the bare-bones handler file:
>
> #!/usr/bin/perl
>
> # creates new CGI object using the CGI.pm library
> use CGI qw(:standard);
> $query = new CGI;
You dont need to import the symbols (qw(:standard)) *and* instantiate a
CGI object - you have to decide whether you want to use the procedural
or the OO interface to CGI.pm - generally if you only have a simple
program then the procedural interface will be fine ...
I dont think thats the cause of your problem though.
BTW you shouldnt need to install CGI.pm on a recent Perl as it is part
of the distribution.
/J\
--
"Do you want to go to court today?" - BBC News Website
------------------------------
Date: Fri, 1 Oct 1999 08:58:16 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Using multiple query strings
Message-Id: <FIx294.3M9@csc.liv.ac.uk>
In article <wtMI3.1127$CL1.9703882@news-read1.qis.net>,
"Donboy" <webmaster@roleplayinggames.net> writes:
>> Gawddd no. Not again. Is some one breeding these idiots just to annoy us?
>
> I'm not sure what to make of this. Ian, I really appreciate the help, but
> do you think it's necessary (or productive) to be so condescending? I
> realize that you're on the other end of a phone line and I'm sure you've got
> dozens of online friends, but that doesn't mean you can't make a few more.
> Try being nice to people sometime and I think you will benefit from it.
> Continue saying things like this, and you'll probably be hit by a hacker
> someday who doesn't appreciate the insults. I mean, what's the deal??? Is
> this newsgroup a "geniuses only club" or something? Surely this newsgroup
> has had its share of beginners in the past. Do you always greet them with
> this kind of remark?
No. But when they post broken (or possibly broken but bad methods) that
then get archived on deja.com and other places for other unsuspecting new
perlers to stumble on and copy, it makes me mad.
Since this question probably gets asked and answered correctly at least 2
or 3 times a week (in the 18 months I have been hanging out here) it gets
to you.
I can begin to sympathise with the likes of abigail and others who have
been here much longer.
Code like that posted should only be used by those experienced enough to
know what and why they are doing it. All those who are new to perl should
be introduced to CGI.pm first so that they can learn and gain the
experience necessary to make the second judgment call.
Plus there are enough other things you can get wrong while your learning,
knowing that the reading and parsing of forms is taken care of you can
focus your debugging elsewhere.
Now if Vox had lurked here for long enough he would have known the answer
and more importantly why the gurus and others frown on posting broken
code. (Not that I am anywhere near to being a perl guru).
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Executive ability is deciding quickly and getting somebody else to do
the work.
-- John G. Pollard
------------------------------
Date: 1 Oct 1999 04:48:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Using SS Numbers as DBM Index: Best Way to Encrypt Them
Message-Id: <slrn7v91ah.8i.abigail@alexandra.delanet.com>
George Kuetemeyer (george.kuetemeyer@mail.tju.edu) wrote on MMCCXXI
September MCMXCIII in <URL:news:37F38C5C.B0D60F72@mail.tju.edu>:
// I need to create several DBM files based on feeds from various campus
// systems. I want to use social security numbers as indices, but would
// like to encrypt them for the sake of privacy. Since I want to use the
// values as unique keys, the encryption method needs to return a unique
// string for each ssn. I tried the crypt function (my $encrypted =
// crypt($ssn, $salt) but it appears to disregard the 9th digit in the ssn,
// thereby returning the same value for ssn's where the first 8 digits are
// the same. I don't care about decryption, since there's no need to
// retrieve an ssn from the encrypted value. That's why I looked at crypt
// as a solution.
Double the 9th digit and use that as the salt. Then throw away the
first 2 characters of the result.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 01 Oct 1999 11:45:52 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Validating email addresses.
Message-Id: <pudge-0110990745590001@192.168.0.77>
Abigail, that rules.
For helping to save the world ...
Abigail++
Damian++
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 1 Oct 1999 09:35:31 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: why use references - in laymans terms?
Message-Id: <7t1v93$d9q$1@lublin.zrz.tu-berlin.de>
Jonathan Stowe <gellyfish@gellyfish.com> wrote in comp.lang.perl.misc:
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Uri Guttman <uri@sysarch.com> wrote in comp.lang.perl.misc:
>>
>>>if you don't want to use references, go back to using perl4. (but only
>>>if you like flogging a flea bitten dead camel carcass)
>>
>> Call me a pedant, but fleas don't bite dead animals. How about
>> moth-eaten?
>>
>
>Maybe it was bitten before it was dead ...
Maybe it was, but that doesn't have the appropriate yuck appeal.
Anno
------------------------------
Date: Fri, 01 Oct 1999 06:27:48 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Win32, Is there a way to associate the PID and it's image...
Message-Id: <37F48CA4.B0927469@patriot.net>
> Is there a way to get the 'image' information that is associated to a PID,
> as in the
> Task Manager?
Check out
http://www.generation.net/~aminer/Perl/
I think Win32::iProc maybe exactly what you're looking for....
carv
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 962
*************************************