[8513] in Perl-Users-Digest
Perl-Users Digest, Issue: 2130 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 18 19:18:49 1998
Date: Wed, 18 Mar 98 16:02:00 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 18 Mar 1998 Volume: 8 Number: 2130
Today's topics:
Re: Qui sera assez fort pour repondre a ca ?? (Stefaan A. Eeckels)
Re: Qui sera assez fort pour repondre a ca ?? <jason@primal.ucdavis.edu>
Re: Qui sera assez fort pour repondre a ca ?? <tchrist@mox.perl.com>
regexp question -- making $replacestring = '$1' work <cherold@pathfinder.com>
Re: removing everything between < and > jason@cimedia.com
Running CGI-scripts on a webserver 2 <ralphmoch@swol.de>
Re: script error on web with perl <chasecreek.systemhouse@usa.net>
Re: stripping "special" characters from string (John Klassa)
Re: stripping "special" characters from string <tchrist@mox.perl.com>
Re: SUMMARY Need help parsing a text file <bbrown@sna.com>
The Answer to "Is there a "Newsgroup" for Newbies to Pe jason@cimedia.com
Troubles "perl"ifying a shellscript that uses pipes <rich@polar.earth.nwu.edu>
Re: Wanted: email address gleaner (Nathan V. Patwardhan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Mar 1998 20:50:39 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A. Eeckels)
Subject: Re: Qui sera assez fort pour repondre a ca ??
Message-Id: <6epc2v$fv8$1@justus.ecc.lu>
In article <MPG.f79f05fdefb9486989683@news.axime.com>,
cfockeu@atos-group.com (ATOS) writes:
Cher Cedric, il serait utile de faire ton post en anglais, car
a) ceci est un newsgroup anglais
b) la majeure partie des 'gurus' actifs dans ce
group ne comprennent pas le francais.
> Salut,
>
> Je cherche (desesperement ?) comment faire pour retrouver une cle
> dans un tableau associatif grace a la valeur qui y est associee.
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
"Don't worry about people stealing your ideas. If your ideas
are any good, you'll have to ram them down people's throats."
-- Howard Aiken
------------------------------
Date: Wed, 18 Mar 1998 13:14:12 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Qui sera assez fort pour repondre a ca ??
Message-Id: <Pine.OSF.3.95.980318130659.23558C-100000@primal.ucdavis.edu>
On 18 Mar 1998, Stefaan A. Eeckels wrote:
> In article <MPG.f79f05fdefb9486989683@news.axime.com>,
> cfockeu@atos-group.com (ATOS) writes:
> Cher Cedric, il serait utile de faire ton post en anglais, car
> a) ceci est un newsgroup anglais
> b) la majeure partie des 'gurus' actifs dans ce
> group ne comprennent pas le francais.
C'est peut-etre vrai pour 'la majeure partie des "gurus" actifs,' mais
c'est certainement faux pour le guru majeur, M. Tom Christiansen. Mais
si tu lui ecrit dans une langue non-anglaise, il faut etre pret a lire sa
reponse dans une bouillabaisse de ses langues non-anglaises.
Heureusement il n'a pas sorti cette fois son suepanol (dialecte
formidable de la famille ibero-scandinave).
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: 18 Mar 1998 21:28:39 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Qui sera assez fort pour repondre a ca ??
Message-Id: <6epea7$qvr$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Stefaan.Eeckels@ecc.lu (Stefaan A. Eeckels) writes:
: b) la majeure partie des 'gurus' actifs dans ce
: group ne comprennent pas le francais.
Presque tous, je dirais. :-)
I don't want to discourage anyone from asking good questions, but you
just aren't going to get far posting in French to an international forum.
English is the world's number one second language, and it's very difficult
to get anywhere in computing or business without it. But since he asked
a FAQ, perhaps he *couldn't* read the FAQ. Alas!
/* lodging tongue firmly in cheek */
Of course, it could be that the poster had exhausted his legally permitted
quantity of English for the month, and the Language Police would have
gotten on his case otherwise. In fact, since web sites in France must
legally be in French, perhaps he posted via the web. Heck, maybe even
anything written in France must be in French. Posting in English could
be construed to be using cryptography, which is also--yes you guessed it--
illegal dans la belle France. :-)
Chi sa? Quiza? Keys.. ah!
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Be consistent.
--Larry Wall in the perl man page
------------------------------
Date: Wed, 18 Mar 1998 16:53:01 -0500
From: "Charles Herold" <cherold@pathfinder.com>
Subject: regexp question -- making $replacestring = '$1' work
Message-Id: <6epfk1$pah$1@news1-alterdial.uu.net>
I have a script that reads a search and replace string from a text file.
The text file is like this:
this, that(.*?)the other
$1
After opening the text file, the script does this:
$search = <INPUT>;
$replace = <INPUT>;
Obviously what I want is for
test = "this, that and the other";
test =~ s/$search/$replace/;
to result in test containing " and ", but what it actually contains is "$1".
Is it possible to do what I want?
Best Regards,
Charles Herold
cherold@pathfinder.com
------------------------------
Date: 18 Mar 1998 16:04:44 -0600
From: jason@cimedia.com
Subject: Re: removing everything between < and >
Message-Id: <85g1kfejur.fsf@Taz.i-did-not-set--mail-host-address--so-shoot-me>
Yashesh Shroff <yashesh@eecs.berkeley.edu> writes:
> hi all!
> I have tried the perl documentation but was not able to find any source
> for my following problem:
> I would like to remove everything between '<' and '>' in a line and for
> all the instances. I am trying to work out a script that basically
> removes all the formatting tags in an HTML document. For the script:
> -----------
> $line = "This is <strong>strong</strong> and this is <b>bold</b> and
> this is plain text.";
> $line =~ s/<.+>//g;
> print $line;
> ----------------------------
> I get the result:
> This is and this is plain text <<notice that "strong" and "and this
> is" and "bold" are also removed!
> --------------------------------------------
> everything between < and > is removed, however, if there is a second '>'
> in the line, perl takes the largest instance of the match.
> Anyway of making perl see the shortest instance of a match?
> I cannot use the HTML module because it is not availabe on my university
> system.
use HTML::Parse;
$line = q(This is <strong>strong</strong> and this is <b>bold</b>
and this is plain text.);
$line = parse_html($line)->format;
--
Jason Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media -- Austin
------------------------------
Date: Thu, 19 Mar 1998 00:52:10 +0100
From: Ralph Moch <ralphmoch@swol.de>
Subject: Running CGI-scripts on a webserver 2
Message-Id: <35105E2A.52C90F09@swol.de>
My problem is that. I placed two CGI-scripts on a webserver in the
cgi-bin directory, I changed the mode to 755 (script and directory). The
mailform script runs if I remove the sendmail order. The login script
doesn4t run.
If I execute the scripts (mailform with sendmail option) the server
sends me following message:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster@druecker.de and
inform them of the time the error occurred, and anything you might have
done that may have
caused the error.
Hope somebody can help me
Thx Ralph
------------------------------
Date: Wed, 18 Mar 1998 23:25:37 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: script error on web with perl
Message-Id: <35105699.C9B25AA5@usa.net>
If your code example is complete, you forgot this -
print "Content-type: text/html\n\n';
You see, even through you are 'just' writing to the DB handle, the Web
Server is
expecting the output to be in an appropriate HTTP format, so you have to
trick it into thinking the data will appear there - then write it out to
file (of course,
a file your Web Server usrid has premission to write to...)
HTH,
Sneex :-)
PS - It is in your best interests to have the
latest and the greatest - Perl 5.004x and CGI.pm :-)
Brian Charles wrote:
> Hi,
> I have the following script which works, but on the web it returns a
> "Internal Service Error"
> Why? I would like it to redirect to somewhere. How do I do that?
> Yes, I do realize this is more of a CGI question, but that newsgroup
> does not seem to be functioning.
> Thanks
>
> #!/usr/bin/perl
>
> require "cgi-lib.pl";
>
> &ReadParse(*form_data);
>
> open(DB,">>surveyresults"); #open file for appending
> print DB "$form_data{'i_copy_neg'},";
> print DB "$form_data{'i_portraiture'},";
> print DB "$form_data{'i_documentary'},";
> print DB "$form_data{'i_specimen'},";
> print DB "$form_data{'i_dupes'},";
> print DB "$form_data{'i_clr_cpy'},";
> print DB "$form_data{'i_comp_slides'},";
> print DB "$form_data{'i_scanning'},";
> print DB "$form_data{'i_comp_manip'}\n";
> close DB;
------------------------------
Date: 18 Mar 1998 20:52:10 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: Re: stripping "special" characters from string
Message-Id: <6epc5q$r9j$1@aurwww.aur.alcatel.com>
On 18 Mar 1998 16:31:19 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
->ENOPEE
ENOPEE?
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: 18 Mar 1998 21:45:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: stripping "special" characters from string
Message-Id: <6epf93$rtp$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, klassa@aur.alcatel.com questions me:
:ENOPEE?
splice, slice.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
MAGIC* xmg_magic; /* linked list of magicalness */
--Larry Wall, from sv.h in the v5.0 perl distribution
------------------------------
Date: Wed, 18 Mar 1998 14:50:03 -0800
From: Barry Brown <bbrown@sna.com>
Subject: Re: SUMMARY Need help parsing a text file
Message-Id: <35104F9B.62F4528C@sna.com>
Barry Brown wrote:
>
> With these definititions:
>
> $TEXT = 0;
> $STMT = 1;
>
> I want to turn this:
>
> Some text
> %{ statement 1 %}
> Some more
> text
> %{ statement 2}%%{ statement 3 }%
> %{multi-line
> statement 4}%text%{ statement 5 }%
>
> into an array, @prog, of array refs:
>
> $prog[0] = [$TEXT, "Some text\n"]
> $prog[1] = [$STMT, "statement 1"]
> $prog[2] = [$TEXT, "\nSome more\ntext\n"]
> $prog[3] = [$STMT, "statement 2"]
> $prog[4] = [$STMT, "statement 3"]
> $prog[5] = [$TEXT, "\n"]
> $prog[6] = [$STMT, "multi-line\nstatement 4"]
> $prog[7] = [$TEXT, "text"]
> $prog[8] = [$STMT, "statement 5"]
> $prog[9] = [$TEXT, "\n"]
>
> (or something close to this)
Ed Overton replied to my posting with a snippet of code that did exactly
what I wanted with simplicity.
$TEXT = 0;
$STMT = 1;
$working_line = "";
@prog = ();
open FILE, "./testme"
or die "Can't open ./testme.\n";
while(<FILE>) {
$working_line .= $_;
while ($working_line =~ /%{.*}%/) {
($prefix, $working_line) = split /%{/, $working_line, 2;
push @prog, [$TEXT, $prefix] if $prefix;
($cmd_line, $working_line) = split /}%/, $working_line, 2;
push @prog, [$STMT, $cmd_line] if $cmd_line;
}
}
close FILE
or warn "Couldn't close ./testme.\n";
With only a few modifications to fit it into my real program, it worked
perfectly the first time.
Thanks!
--
Barry E. Brown Internet: bbrown@sna.com
Sacramento Network Access / Internet Network Technologies, Inc.
System Administrator/Technical Support/Engineering
Home page: http://dottie.sna.com/bbrown/
------------------------------
Date: 18 Mar 1998 15:38:56 -0600
From: jason@cimedia.com
Subject: The Answer to "Is there a "Newsgroup" for Newbies to Perl?"
Message-Id: <85iupbel1r.fsf@Taz.i-did-not-set--mail-host-address--so-shoot-me>
Q: Is there a "Newsgroup" for Newbies to Perl?
A: Yes. It's called comp.lang.perl.misc and you can find your answer
via DejaNews (www.dejanews.com). I've only been programming perl for
three years so I'm no expert. But, I do have some bizarre needs and
I've yet to come across a question or problem that I have not been
able to find an answer or a solution to with perldoc or in the Perl
FAQ, Programming Perl, Mastering Regular Expressions, Advanced Perl
Programming or, best of all, DejaNews.
And, guess what? If you have a question that can not be answered by
reading or using one of the above resources -- I guarantee you've
got a question suitable for c.l.p.m.
(I've just started using emacs for my newsreader so if this is not
formatted correctly, I apologize.)
--
Jason Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media -- Austin
------------------------------
Date: 18 Mar 1998 14:08:00 -0600
From: Jonathan Rich <rich@polar.earth.nwu.edu>
Subject: Troubles "perl"ifying a shellscript that uses pipes
Message-Id: <wfwwdrbw4f.fsf@polar.earth.nwu.edu>
I have been trying to "perl"ify a shellscript. The motivation is that
I need to have the capability of floating-point math, whereas the
shell I am using (bash) only does integer arithmetic. So for example,
I may have a variable that has the value "5" and I want "5/2" to be
2.5 So I decided to switch to perl which of course has the math
capabilities I am after. I thought all I would have to do is use
perl's "system()" call, but have been running into great difficulty
since it seems to have trouble w/ UNIX pipes. Take the following
simple example and tell me how to do it:
$n=5;
system("echo This line has $n words | cat");
This will work. Now suppose I want to interpolate in the value, $n+1.
I try:
system("echo This line has $n+1 words | cat");
This doesn't work because of the quotes which prevent perl from doing
the math I want. If I try to get rid of the quotes by making the
system call into a list, there are problems w/ the "|" (pipe) which
I haven't been able to figure out how to circumvent.
>From the reading I've done, it doesn't appear that the system function
is really intended for pipes, but rather for a single command.
Yet in the shell, pipes are commonplace and quite useful and I would
certainly be disappointed if I can't use perl for my math while still
getting done the things that I was using the shellscript for. My
hope was that perl, w/ floating-point capability, would give me more
flexibility than a shell but if I can't do pipes, I'll have to revert
to the shell.
Any advice or help will be greatly appreciated. Thanks.
--
Jonathan Rich
rich@earth.nwu.edu
Geoscience Dept.
Northwestern Univ.
------------------------------
Date: 18 Mar 1998 22:51:44 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Wanted: email address gleaner
Message-Id: <6epj60$gf3@fridge.shore.net>
Jeff Potter (jp@glpbooks.BADMAIL.com) wrote:
: Do you call posts from your mom spam, too? Please, give a reason as
: to why the above might be spam. ---It's a specific response to a specific
: post. It's *ontopic* to both the newsgroup and the specific posts involved.
[snip]
It's not that you're spamming or intend to, but it's that giving you
such code is something that *everyone* can see and use for evil
purposes. At least that's why I'm not fond of doing this for you.
--
Nathan V. Patwardhan
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2130
**************************************