[12059] in Perl-Users-Digest
Perl-Users Digest, Issue: 5659 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 14 04:07:20 1999
Date: Fri, 14 May 99 01:01:36 -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 Fri, 14 May 1999 Volume: 8 Number: 5659
Today's topics:
Please Help: Web Form Email <mcandidate@hotmail.com>
Re: print to STDOUT and a file at the same time? (H. Tiltmann)
problem with perl and IIS 4.0 <sova0001@algonquinc.on.ca>
Re: regexp ?: how to ignore escaped delimiter? (Ilya Zakharevich)
Re: regexp ?: how to ignore escaped delimiter? <tchrist@mox.perl.com>
Re: regexp ?: how to ignore escaped delimiter? (Ilya Zakharevich)
REGULAR EXPRESSION Problem 2 (Ryan Ngi)
Re: REGULAR EXPRESSION Problem 2 <baliga@synopsys.com>
Show the error of script via Browser (Ryan Ngi)
Re: Show the error of script via Browser <baliga@synopsys.com>
Re: Show the error of script via Browser (Tad McClellan)
Re: SQL Server via TCP/IP? (Stu)
Re: Vax username/passwd check via Net::Telnet sroque@my-dejanews.com
Re: Vax username/passwd check via Net::Telnet sroque@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 May 1999 23:45:58 GMT
From: "Joey" <mcandidate@hotmail.com>
Subject: Please Help: Web Form Email
Message-Id: <01be9d9a$8fb9de80$be1ae380@computer>
I know very little Perl, though I am trying... I have an HTML form to be
used for emailing a list of people. Anyone on the list can access the
webpage to send out a mass email to the group. I downloaded a script that
serves a similar purpose, and have been trying unsuccessfully to modify it
for two days now. Can anyone see an obvious mistake in the code?
I think the error is somewhere in either the send function or directories
(I'm not a UNIX newbie, but by no means a guru either).
Thanks for any input.
------------------------------------------------------------------
#!/usr/local/bin/perl
$basedir = "/public_html/cgi-bin/";
$SENDMAIL = "/usr/local/bin/sendmail";
&parse;
$from = "$FORM{'from'}";
$mailinglist = "$FORM{'mailinglist'}";
@message = "$FORM{'body'}";
&bulk;
###print "Just some random HTML. I know this part is correct.";
sub bulk { open (LIST, "$basedir$mailinglist");
@recips = <LIST>;
foreach $recips (@recips) { &send; }
close (LIST);
}
$allow_html = "1";
sub parse {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~s/\r/ /g;
$value =~s/\n//g;
$value =~s/|//g;
if ($allow_html = 1) { $value =~ s/<([^>]|\n)*>//g; }
$FORM{$name} = $value;
}
}
sub send {
open (MAIL, "| $SENDMAIL $recips");
print MAIL "Subject: $FORM{'subject'}\n";
print MAIL "From: $FORM{'from'}\n";
print MAIL "To: $recips\n\n\n";
print MAIL "@message";
close (MAIL);
}
------------------------------
Date: Fri, 14 May 99 05:19:05 GMT
From: hti@lago.ping.de (H. Tiltmann)
Subject: Re: print to STDOUT and a file at the same time?
Message-Id: <7hfpif$rpp$1@lilly.ping.de>
In article <7hemej$8k1$1@nnrp1.deja.com>, bing-du@tamu.edu wrote:
>Greetings all...
>
>How to use 'print' statement to output to STDOUT and a file at the SAME
>TIME?
>
>print "hello world\n"; --- STDOUT
>print FILE "hello world\n"; ---- FILE
>
I would use the 'tee' shell tool, as has been said already.
Anyway it is possible to do this within your script:
sub myprint {
my $str = shift;
print $str;
print FILE $str;
}
&myprint("This is to be printed to either output.\n");
But I guess this is more expensive than the tee solution. I got no way to
check the syntax now, but anyway you see what I mean.
Helmut
------------------------------
Date: Thu, 13 May 1999 20:08:03 -0400
From: Jason Sova <sova0001@algonquinc.on.ca>
Subject: problem with perl and IIS 4.0
Message-Id: <373B6963.10836D77@algonquinc.on.ca>
I'm trying to get perl to run cgi on an NT server running iis 4.0
I've installed active perl and it said it made the links to the files
and I've
manually add the perl exe to the apps dialog in iis server manage but
when I try and run the script by typing in the url or running it from a
small HTML form it just tries to download the .pl file insted of running
it
Any idea's on this problem???
Jason
------------------------------
Date: 13 May 1999 22:38:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regexp ?: how to ignore escaped delimiter?
Message-Id: <7hfk9e$pk1$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Spica
<reply@newsgroup.please>],
who wrote in article <373b1dd8.261530541@news2.realtime.net>:
> >Yet another example of not trusting this book for best advice.
>
> As I'm totally fresh to this regular expressions topic, I had found
> this book by searching on the web and decided to order it as in aid to
> learning perl. Is it not a good book?
It is a remarkable book about non-Perl RExen. It is a remarkable book
about toying with RExen in Perl 5.002.
But those RExen are divided into two big parts: those which do not
need any toying around, and those which do not need any toying
anymore.
> Or are some of the examples just outdated with new revisions of
> perl?
A lot of *problems* are outdated. The Perl-specific part of the book
spends most of the time addressing problematic parts of REx engine of
5.002, and the ways to circumvent these problems. Most of these are gone.
Jeffrey spent enoromous amount of time investigating different REx
engines. But any investigation of an artificial object has an
important distinction with investigating nature: nature stays, but
artificial objects go. A research on flogistone theory ("heat
liquid") still bears a lot of significance today, even if we know that
it does not reflect 100% how the heat is transfered. A research on
spark plugs of Toyota 1976 is only as good as those spark plugs.
Ilya
------------------------------
Date: 13 May 1999 16:40:54 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: regexp ?: how to ignore escaped delimiter?
Message-Id: <373b54f6@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:A lot of *problems* are outdated. The Perl-specific part of the book
:spends most of the time addressing problematic parts of REx engine of
:5.002, and the ways to circumvent these problems. Most of these are gone.
Please explain which ones that he describes, have been fixed.
--tom
--
The IQ of the group is the lowest IQ of a member of the group divided
by the number of people in the group.
------------------------------
Date: 13 May 1999 22:52:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regexp ?: how to ignore escaped delimiter?
Message-Id: <7hfl2t$pu5$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <373b54f6@cs.colorado.edu>:
> :A lot of *problems* are outdated. The Perl-specific part of the book
> :spends most of the time addressing problematic parts of REx engine of
> :5.002, and the ways to circumvent these problems. Most of these are gone.
>
> Please explain which ones that he describes, have been fixed.
I wrote to Tom: I know two problems which still remain:
there is no (or only very weak) first-char (or better) cognizance, and
it is still possible to write never-ending expressions
(though addition of (?>...) makes it easy to avoid most of the
problems of this kind).
But then I realized that there is an additional one introduced later:
//i matches do not have substring cognizance any more (this change
slowed down some actual programs circa 300 times). But apparently
nobody cares about this: my invitations to rewrite fbm_instr() or at
least ninstr() to allow case folding were never replied.
Ilya
------------------------------
Date: Fri, 07 May 1999 21:51:52 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: REGULAR EXPRESSION Problem 2
Message-Id: <35522976.10384300@news.inet.co.th>
Hi
i have another REGULAR EXPRESSION problem that i cant solve for a long
time..... it is
2. give $Var='a bat is on the rat, the rat is on the pig';
i want $1 to store 'bat is on the rat'......
i use this to do the work
-------------------------------------------
$Var='a bat is on the rat, the rat is on the pig';
$Var=~/(b.*rat)/;
print $1;
------------------------------------------
the screen print out "bat is on the rat, the rat"
oh yeah, you see, it's wrong,
This is only my stupid example, but if the sentense is not easy....
good regular expression will be needed.
what is the regular expression to use in this case??? please help as
fast as possibleeeeeeee.....
------------------------------
Date: Thu, 13 May 1999 16:19:23 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: REGULAR EXPRESSION Problem 2
Message-Id: <373B5DFA.8BCD99ED@synopsys.com>
Use Minimal Regular Expression matching.. In this case,
$Var =~ /(b.*?rat)/;
-- Baliga
Ryan Ngi wrote:
> Hi
>
> i have another REGULAR EXPRESSION problem that i cant solve for a long
> time..... it is
>
> 2. give $Var='a bat is on the rat, the rat is on the pig';
> i want $1 to store 'bat is on the rat'......
> i use this to do the work
> -------------------------------------------
> $Var='a bat is on the rat, the rat is on the pig';
> $Var=~/(b.*rat)/;
> print $1;
> ------------------------------------------
> the screen print out "bat is on the rat, the rat"
>
> oh yeah, you see, it's wrong,
>
> This is only my stupid example, but if the sentense is not easy....
> good regular expression will be needed.
>
> what is the regular expression to use in this case??? please help as
> fast as possibleeeeeeee.....
------------------------------
Date: Fri, 07 May 1999 22:03:30 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: Show the error of script via Browser
Message-Id: <373361e1.11643960@news.inet.co.th>
i'm finding a way to show errors of a script via Browser......
.....
when an error occur, the Browser(Apache Server) will display this
"Error......... contact you admin admin@xxx.net";
or something like this......
so I counld not know what the error it is???
is there any way to show the error out so that i can debug it
easier........
(i can't telnet to that server)
------------------------------
Date: Thu, 13 May 1999 16:21:57 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Show the error of script via Browser
Message-Id: <373B5E95.270DB38C@synopsys.com>
If the error is while executing the script, that can be caught and shown
on the
browser.. But if the error occur while parsing the script, you cannot
catch it and
show it on the browser... Since the parsing is done before the starting
of
exceution of the script.
- Baliga
Ryan Ngi wrote:
> i'm finding a way to show errors of a script via Browser......
> .....
>
> when an error occur, the Browser(Apache Server) will display this
> "Error......... contact you admin admin@xxx.net";
>
> or something like this......
>
> so I counld not know what the error it is???
>
> is there any way to show the error out so that i can debug it
> easier........
>
> (i can't telnet to that server)
------------------------------
Date: Thu, 13 May 1999 16:35:59 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Show the error of script via Browser
Message-Id: <f3dfh7.1j2.ln@magna.metronet.com>
Yogish Baliga (baliga@synopsys.com) wrote:
: If the error is while executing the script, that can be caught and shown
: on the
: browser.. But if the error occur while parsing the script, you cannot
: catch it and
: show it on the browser... Since the parsing is done before the starting
: of
: exceution of the script.
That is not true.
use CGI::Carp 'fatalsToBrowser';
One line causes errors and warnings to be displayed in the browser.
: Ryan Ngi wrote:
: > i'm finding a way to show errors of a script via Browser......
: > .....
: >
: > when an error occur, the Browser(Apache Server) will display this
: > "Error......... contact you admin admin@xxx.net";
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 14 May 1999 00:26:52 GMT
From: sbrowne@iinet.net.xx (Stu)
Subject: Re: SQL Server via TCP/IP?
Message-Id: <373b6c24.4455791@news.m.iinet.net.au>
Allen Windhorn <Windhorn_Allen_E@cat.com> wrote:
>Can I use perl to connect to a SQL Server 7 database via TCP/IP? If
>so, where would I get more information? I want to do this from a
>Windows NT system, and the database is on NT Server.
Allen,
I would think this would be fairly simple with Win32::ODBC however you
would of course have to have a datasource setup on the machine you are
running the script from which means you would also have to map the NT
server drive (where the database resides) as a network drive. I would
love to be corrected on this :-)
-Stu
------------------------------
Date: Fri, 14 May 1999 01:31:52 GMT
From: sroque@my-dejanews.com
Subject: Re: Vax username/passwd check via Net::Telnet
Message-Id: <7hfue9$7q6$1@nnrp1.deja.com>
I need the CGI program because the individual login account is distinct.
My follow-up question would be if the username/password is invalid how
can I output the VAX error msg to the browser? Are there any samples
using this module in the web?
Any help will be greatly appreciated.
> Yes, you can use Net::Telnet to check a user login and password.
>
> However, from a security standpoint you really should setup the
> web server to do the authentication as opposed to a CGI program.
>
> --
> Jay Rogers
> jay@rgrs.com
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Fri, 14 May 1999 01:31:55 GMT
From: sroque@my-dejanews.com
Subject: Re: Vax username/passwd check via Net::Telnet
Message-Id: <7hfueb$7q7$1@nnrp1.deja.com>
I need the CGI program because the individual login account is distinct.
My follow-up question would be if the username/password is invalid how
can I output the VAX error msg to the browser? Are there any samples
using this module in the web?
Any help will be greatly appreciated.
> Yes, you can use Net::Telnet to check a user login and password.
>
> However, from a security standpoint you really should setup the
> web server to do the authentication as opposed to a CGI program.
>
> --
> Jay Rogers
> jay@rgrs.com
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5659
**************************************