[9207] in Perl-Users-Digest
Perl-Users Digest, Issue: 2802 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 6 19:07:31 1998
Date: Sat, 6 Jun 98 16:00:25 -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 Sat, 6 Jun 1998 Volume: 8 Number: 2802
Today's topics:
Re: A Question about Quotes (Mark-Jason Dominus)
Am I looking at an anonymous array (Erland Sommarskog)
Re: Foreach Efficiency <p-fein@uchicago.edu>
Re: Foreach Efficiency (Jonathan Stowe)
Re: Foreach Efficiency <tchrist@mox.perl.com>
Re: Foreach Efficiency (Jonathan Stowe)
Re: How to access MS SQLSever on NT using Perl ??? (Erland Sommarskog)
Idiom for updating file? (Craig Berry)
Re: IP to DNS <tchrist@mox.perl.com>
Re: newbie problem opening pipe (Jonathan Stowe)
Re: Novell Web Server, PERL, and base64 encoding <palincss@tidalwave.net>
Re: Novell Web Server, PERL, and base64 encoding (Jonathan Stowe)
Oh bloody hell (Jonathan Stowe)
Problem: With the $ENV{'blah'} variable <zeos@gti.com>
Re: Problem: With the $ENV{'blah'} variable (Jonathan Stowe)
Re: Problem: With the $ENV{'blah'} variable (Bob Trieger)
Saving dynamically created images (Derrick Lathem)
Re: Saving dynamically created images <stathy@jaske.com>
Switching PERL scripts from UNIX to NT- Help! <mcate@gmu.edu>
Re: Switching PERL scripts from UNIX to NT- Help! (Bob Trieger)
Win95 problems for Perl? Need assistance here! (Joshua McAdams)
Re: Win95 problems for Perl? Need assistance here! <zeos@gti.com>
Re: Win95 problems for Perl? Need assistance here! <bowlin@sirius.com>
Re: Yes, 'No it's not' is not it (was: Yes, I think it (Andre L.)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Jun 1998 15:47:15 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: A Question about Quotes
Message-Id: <6lc6c3$ggd$1@monet.op.net>
Keywords: bolster medley momentous tact
In article <Pine.LNX.3.96.980606124212.2310A-100000@mercury.shreve.net>,
Brian <signal@shreve.net> wrote:
>$statment="INSERT INTO $table VALUES ('$realname','$username')";
>$sth = $dbh->query($statment);
>The problem is, what if the users real name is "Larry O'Keefe", it screws
>up because of the ' in Larrys name it gives parse errors.
>How does one normally fix something like this?
In general, the solution is to do something like:
$realname =~ s/(['\\])/\\$1/g;
or
$username =~ s/'/''/g;
before you interpolate these into the statement.
You can get this to happen semi-automatically if you use the
`Interpolation' module. (<URL:http://www.plover.com/~mjd/perl/Interpolation/>)
Then you'd write this:
# Put this at the top of your program.
use Interpolation "'" => sub {$_=$_[0];s/'/''/gm;"'".$_};
...
$statment="INSERT INTO $table VALUES ($'{$realname}',$'{username}')";
$sth = $dbh->query($statment);
$'{...} means that the string is supposed to be suitably escaped
before it is interpolated into the $statement.
This trick was invented by Jan Krynicky.
------------------------------
Date: Sat, 06 Jun 1998 19:41:43 GMT
From: sommar@algonet.se (Erland Sommarskog)
Subject: Am I looking at an anonymous array
Message-Id: <6lc619$h9d$1@cubacola.tninet.se>
THE SHORT QUESTION:
If say "ref $x" I might get ARRAY or HASH in return. But can I tell
whether this array or hash is a real variable, or just an anonymous
entity?
WHY ON EARTH DO I WANT TO DO THAT?
In my MSSQL::Sqllib module there is this routine:
$resultref = [$X->]sql_sp($sp [, \$sp_retstat] [, \@params]
[, \%params] [, $rowstyle], [, $resultstyle]]);
$sp is the name of a stored procedure, $sp_retstat is the return status,
and @params and %params are parameters to the stored procedure, and the
question concerns these two. @params are unnamed positional parameters,
and %params are named parameters, but that does not really matter here.
What does matter is that a parameter to a stored procedure may be an
output parameter, that is you get a value back. As you can get values
back in other ways as well, output parameters are not so common and
are maybe 5% of all stored-procedure parameters in this world.
If the caller says
A) @params = (1, 2);
sql_sp("some_sp", @params);
and the last parameter is an output parameter as well, $params[2] will
hold the return value after the call to sql_sp. But if the caller says:
B) sql_sp("some_sp", [$param1, $param2]);
$param2 will of course be unchanged after the call to sql_sp. He has to
say:
C) sql_sp("some_sp", [$param1, \$param2]);
sql_sp is clever enough when it examines the parameter arrays to see
if an array element is a reference or a value, and deference if
necessary. Since B) is a bit develish, and might trap the causual
programmer sql_sp emits a warning if finds that the array element for
an output parameter is not a reference. However, in A) this warning
is completely bogus.
So I what would like to is on the inside sql_sp inspect my array and
hash references to find out whether they refer to a named variable or
an anonymous array/hash, so I only emit a warning when appropriate.
Is this possible? Am I asking for a new feature? Or is my approach
completely off the target from the beginning.
If anyone cares, full description of the sql_sp is at
http://www.algonet.se/~sommar/mssql/mssql-sqllib2.html#sql_sp
--
Erland Sommarskog, Stockholm, sommar@algonet.se
F=F6r =F6vrigt anser jag att QP b=F6r f=F6rst=F6ras.
B=65sid=65s, I think QP should b=65 d=65stroy=65d.
------------------------------
Date: Sat, 6 Jun 1998 20:11:10 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Foreach Efficiency
Message-Id: <873edis335.fsf@bj2-64.rh.uchicago.edu>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
> In other words, you're foisting off all the work onto us. Thank you so
> much.
Look, I thought it was an easily answered question involving a
subtlety of syntax I wasn't getting. Since when is attempting to
learn from others who are more knowledgeable a bad thing? I've taken
the time to try to learn this language and find my own answers before
posting here. I haven't once posted a "Hey guys, can you write this
sub for me?" type of message, nor would I. I'm surprised that my
concise, well thought out question generated this much animosity,
particurlarly when much more unfocused requests get answered. If you
all feel my question was unreasonable, don't answer it. But don't
give me a hard time b/c I didn't like your response.
--
Peter Fein 773-834-6206
1005 E. 60th St. Chicago, IL 60637
p-fein@uchicago.edu http://pfein.home.ml.org/
------------------------------
Date: Sat, 06 Jun 1998 21:17:50 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Foreach Efficiency
Message-Id: <3579ac12.83815330@news.btinternet.com>
On Thu, 4 Jun 1998 20:46:26 GMT, Peter A Fein wrote :
>A look through the Camel's efficiency section didn't turn up anything,
>so here goes:
>
Nice attempt anyhow
>I have some code that looks like:
>
>foreach my $i (sort article_cmp @all_pages) {
>do_stuff_with($i); # more or less
>}
>
>My inclination is that the list-generating sort only gets done once,
>and therfore doing it outside the loop and storing it in a variable
>which foreach then indexes would be unnecessary. Is this correct?
>
Yes.
The syntax of this should suggest the way it works. In most cases a
() returns a list so whatever occurs within the parentheses will
already have occurred by the time the loop starts. So yes the sort
has already been done before the first iteration of the loop is
executed.
Bear in mind that I have already read the rest of this thread and
would suggest that every suggestion that has been made is perfectly
valid.
When you say:
>But don't give me a hard time b/c I didn't like your response.
You are lapsing into a state of mind that will win you few favours.
These people know of what they speak.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 6 Jun 1998 22:02:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Foreach Efficiency
Message-Id: <6lceab$r8f$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Gellyfish@btinternet.com (Jonathan Stowe) writes:
:In most cases a
:() returns a list
I don't think so.
$a = 4*(2+3);
Not to mention the myriad scalar context cases.
--tom
--
if (*name == '+' && len > 1 && name[len-1] != '|') { /* scary */
--Larry Wall, from doio.c in the v5.0 perl distribution
------------------------------
Date: Sat, 06 Jun 1998 22:41:57 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Foreach Efficiency
Message-Id: <3579c2f0.89344739@news.btinternet.com>
On 6 Jun 1998 22:02:51 GMT, Tom Christiansen wrote :
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> Gellyfish@btinternet.com (Jonathan Stowe) writes:
>:In most cases a
>:() returns a list
>
>I don't think so.
>
> $a = 4*(2+3);
>
>Not to mention the myriad scalar context cases.
>
D'oh
Of course on saturday night one tends to lapse into idiotic
generalization.
I dont think there is any qualification I can make to Justify that
really. I blame Sam Peckinpah entirely.
But you know what I meant.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 06 Jun 1998 17:55:04 GMT
From: sommar@algonet.se (Erland Sommarskog)
Subject: Re: How to access MS SQLSever on NT using Perl ???
Message-Id: <6lbvpe$emb$1@cubacola.tninet.se>
"Lowelll Sneller" <lsnelle@max.state.ia.us> skriver:
>Can anyone point me to a source that discusses
>using MS SQLServer on NT using Perl?
>my email is lowell.sneller@its.state.ia.us
If all you want is a discussion forum, you should join the
Perl-Win32-Database list. They've just rearranged the Perl-Win32
lists, so I'm not fully certain on how you subscribe these days.
There should probably info at http://www.activestate.com. Anyway,
the listserver is on lyrics.activestate.com, mail to
listserv@lyrics.activestate.com and "SUB Perl-Win32-Database" in
the body might work.
If you want to access SQL Server on NT, there are three options:
1) Win32::ODBC. This is probably the most popular way. You should
find it at CPAN, Author is Dave Roth. Look for the libwin32
package under the ports section. It's included in there. That
version only works with the native port of Perl, not the ActiveState
perl. http://www.roth.net is a good place to look.
2) ADO/OLEDB. This requires Win32::OLE, which also is in libwin32.
(For ActiveState Perl, OLE support is included). OLEDB is a
basic database interface, just like ODBC, from Microsoft which
uses OLE. ADO is high-level interface to OLEDB. Or so I have
understood it.
3) MSSQL::DBlib and MSSQL::Sqllib. These module using good ol' DB-
Library to access MS SQL Server. DBlib is just the interface, a
port of Michael Peppler's Sybperl. MSSQL::Sqllib is high-level
interface that could work with about any DB engine, but with the
DBI::* modules, I guess the market for it is weak. I like it
though, but then again I wrote it. You find it on
http://www.algonet.se/~sommar/mssql. Currently only available
for Activestate Perl, but I hope to get a version for the native
port out some time.
--
Erland Sommarskog, Stockholm, sommar@algonet.se
F=F6r =F6vrigt anser jag att QP b=F6r f=F6rst=F6ras.
B=65sid=65s, I think QP should b=65 d=65stroy=65d.
------------------------------
Date: 6 Jun 1998 21:58:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Idiom for updating file?
Message-Id: <6lce2h$rdj$1@marina.cinenet.net>
This post is an attempt to reality-check an algorithm I'm using for a CGI
app.
The basic idea is to open a database file, read the whole thing, transform
its contents into an internal representation, modify that representation,
then rewrite the entire file with the external representation of the
modified data. As pseudocode, and leaving out the details, my current
flow looks like:
open DB, '+< dbfile' or die $!;
flock DB, LOCK_EX;
{ local $/; $data = <DB>; }
# Process data here; external rep lands back in $data.
truncate DB, 0;
seek DB, 0, 0;
print DB, $data;
flock DB, LOCK_UN;
close DB;
Does that look like a valid approach? Is there anything I'm neglecting to
do, or doing improperly? Is there a better way?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 6 Jun 1998 22:00:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: IP to DNS
Message-Id: <6lce62$r8f$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Stathy Touloumis <stathy@jaske.com> writes:
:Hi,
: I currently have my httpd log files logging the
:visiting
:clients ip address. Some of my clients would like these to be
:the domain names for there use. I would not like this to be
:done on the server end (slow down) but would instead like to
:write a script which parses the information (ip addresses) and
:converts them to domain names. I am stuck on that part. Am
:currently trying to use the function gethostbyaddr() but am
:unable to determine how to convert the ip addresses into a
:format that gethostbyaddr() can use.
:
:Any suggestions?
use strict;
use Socket;
use Net::hostent;
while (my $ip = <>) {
chomp $ip;
print "$ip => ", ip2host($ip), "\n";
}
sub ip2host {
my ($textip, $bin_ip, $hinfo, $minfo, $alleged_name, $spoof_name);
$textip = shift;
$bin_ip = inet_aton($textip);
return "[$textip]" unless $hinfo = gethost($textip);
$alleged_name = lc($hinfo->name);
for my $ip ( reverse @{ $hinfo->addr_list } ) {
next unless $ip eq $bin_ip;
next unless $minfo = gethostbyaddr($ip);
$spoof_name = lc($minfo->name);
return $alleged_name if $alleged_name eq $spoof_name;
}
my $bogoname = "[" . ($alleged_name !~ /^[a-z]/ && "$textip ->");
return "$bogoname$alleged_name -> $spoof_name]";
}
--
"Most of what I've learned over the years has come from signatures."
--Larry Wall
------------------------------
Date: Sat, 06 Jun 1998 22:41:55 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: newbie problem opening pipe
Message-Id: <3579bc34.87944042@news.btinternet.com>
On Sat, 06 Jun 1998 17:46:41 GMT, sweth@my-dejanews.com wrote :
>I have a bunch of shell-script-based cgi pages that I'm trying to convert to
>perl, to which I am very new. One of the pages keeps exiting with a syntax
>error on line 26 (below, along w/ line 27) that I can't figure out.
<snip>
>
>26: open MAILER, "| /usr/bin/mailx -s 'SMTP Registration Submitted' $NOTIFY"
>27: or die "$REGFAIL" ;
>
Interestingly I just ran this snippet on my box here expecting it to
fail (no mailx - no /usr/bin no nothing) and it just did nothing
whatsoever - no error (and I fixed the error so it would print
something).
Beats me.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 06 Jun 1998 08:44:21 -0700
From: Steve Palincsar <palincss@tidalwave.net>
Subject: Re: Novell Web Server, PERL, and base64 encoding
Message-Id: <357963D5.3A76@tidalwave.net>
Unfortunately, Bob, the Novell Web Server relies on a funky Perl NLM
that is only allegedly a Perl 5. I've experimented with it, and there
doesn't appear to be any way to use modules. I have had some success
using perl 4 libraries other than the hacked version of cgi-lib.pl
supplied with the system, but I haven't looked for a MIME library
to use with it.
I spoke to Jim Olsen at Brainshare about the Perl NLM. He ported the
Netscape server to Novell, and currently has the project of doing a
proper
Perl 5 port. Back then he said it would probably take 6 - 12 months
to do a proper job, and that they intended to port not only Perl, but
also
the functionality of the major unix tools including sendmail, the greps,
etc.
I haven't heard anything since on the effort.
Steve Palincsar
Bob Trieger wrote:
>
> [ posted and mailed ]
>
> Guy Doucet <gdoucet@ait.acl.ca> wrote:
>
> << snippo >>
>
> -> But in order for this to work, I need to encode the actual data. I found
> -> a few sites on the net that seem to indicate that UNIX Servers have
> -> commands that do the encoding for you, I think this would be something
> -> like that:
> -> ====================================
> -> use MIME::Base64;
> -> $encoded = encode_base64('Aladdin:open sesame');
> -> $decoded = decode_base64($encoded);
> -> ====================================
> -> MY QUESTION IS THIS, does Perl5 on the Novell Web Server include similar
> -> commands that will encode data?
>
> If not, you can fine the module on CPAN and install it yourself. I use a
> couple of scripts I wrote using MIME::Base64 on my Win32, Linux and UNIX
> servers.
------------------------------
Date: Sat, 06 Jun 1998 22:41:54 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Novell Web Server, PERL, and base64 encoding
Message-Id: <3579b436.85898086@news.btinternet.com>
On Sat, 06 Jun 1998 08:44:21 -0700, Steve Palincsar wrote :
<snip>
>
>I spoke to Jim Olsen at Brainshare about the Perl NLM. He ported the
>Netscape server to Novell, and currently has the project of doing a
>proper
>Perl 5 port. Back then he said it would probably take 6 - 12 months
>to do a proper job, and that they intended to port not only Perl, but
>also
>the functionality of the major unix tools including sendmail, the greps,
>etc.
You'd better give us his E-Mail address right now.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 06 Jun 1998 19:08:09 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Oh bloody hell
Message-Id: <3579916d.76995842@news.btinternet.com>
On Sat, 06 Jun 1998 18:36:30 GMT, Bob Trieger wrote :
>alecler@cam.org (Andre L.) wrote:
>-> In article <19980606.034959.1K5.rnr.w164w_-_@locutus.ofB.ORG>, Russell
>-> Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:
>->
>-> > I wonder if the original `Yes it is' was misposted in response to the
>-> > `Is perl case-sensitive' question.
>-> >
>-> > in which case `No, It's Not' is wrong.
>->
>->
>-> You are correct on both counts.
>->
>-> But I really posted this just to add another level of nesting to the
>-> subject line. :-)
>
>Now I know who to blame when my bandwidth bill goes up.
>
But he didnt even achieve a further level of nesting. Did he ?
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 06 Jun 1998 15:30:24 -0400
From: David Wasserstrum <zeos@gti.com>
Subject: Problem: With the $ENV{'blah'} variable
Message-Id: <357998D0.507D471B@gti.com>
I just installed a Windows Apache server and am having problems with
perl CGI programing. Programs that are simple such as print "Hello";
run just fine. Programs, however, that require ENV variables are not
working...
recently I tried the following:
#!perl.exe
print "\n";
while (($key,$value) = each %ENV) {
print "$key=$value\n";
}
but I did not recieve any output. This leads me to conclude that for
some reason my apache web server is not creating any enviromental
variables before calling perl.exe. Is this correct??? (i'm not a great
perl programer so I'm not sure if my source code is correct.)
Thanks for your time,
David wasserstrum
------------------------------
Date: Sat, 06 Jun 1998 20:22:18 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Problem: With the $ENV{'blah'} variable
Message-Id: <35799bfa.79695351@news.btinternet.com>
On Sat, 06 Jun 1998 15:30:24 -0400, David Wasserstrum wrote :
>I just installed a Windows Apache server and am having problems with
>perl CGI programing. Programs that are simple such as print "Hello";
>run just fine. Programs, however, that require ENV variables are not
>working...
>
Eh,oh
>recently I tried the following:
>
>#!perl.exe
>print "\n";
>while (($key,$value) = each %ENV) {
> print "$key=$value\n";
>}
>
> but I did not recieve any output. This leads me to conclude that for
>
Of course you deliberately omiitted the :
print "Content-type: text/html\n\n";
didnt you ?
>some reason my apache web server is not creating any enviromental
>variables before calling perl.exe. Is this correct??? (i'm not a great
>
Of course there is wealth of fine documentation available to you
regarding the module CGI.pm and there is also a vast wealth of
documentation regarding CGI in particular and so and and so forth...
>perl programer so I'm not sure if my source code is correct.)
>
>Thanks for your time,
> David wasserstrum
No problem
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 06 Jun 1998 21:29:43 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Problem: With the $ENV{'blah'} variable
Message-Id: <6lccf4$l1t$1@strato.ultra.net>
[ posted and mailed ]
David Wasserstrum <zeos@gti.com> wrote:
-> #!perl.exe
-> print "\n";
-> while (($key,$value) = each %ENV) {
-> print "$key=$value\n";
-> }
->
-> but I did not recieve any output. This leads me to conclude that for
Does it work from the command line?
Does the line: ``print "Content-type: text/html\n\n" '' look familiar?
If this is the solution to your problem you should be ashamed of yourself for
not doing any research before post to c.l.p.m.
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: Fri, 05 Jun 1998 18:09:47 GMT
From: drlathem@atlcom.net (Derrick Lathem)
Subject: Saving dynamically created images
Message-Id: <3578328e.21714256@nntp.atlanta.com>
I am trying to find a way through Perl and JavaScript to hit a site
and save an image without having to physically hit the site, click
save as, and so on.
Basically, I am trying to display a weathermap as a .gif or .jpg on my
site but the site that displays the current map dynamically creates
the image, so the name is not consistent. I don't want to link to
their site or anything easy either.
I want to hit their site via a script in cron, parse out the image
name, "grab" that image (save it on my webserver), and save it as a
certain name. This script is actually running on a webserver.
I hope this makes sense.
Thanks!!
Derrick Lathem
drlathem@atlcom.net
------------------------------
Date: Sat, 06 Jun 1998 15:17:57 -0500
From: Stathy Touloumis <stathy@jaske.com>
Subject: Re: Saving dynamically created images
Message-Id: <3579A3F5.AAACC02D@jaske.com>
Hmmm, sounds like stealing to me . . .
Why not just use the <IMG SRC> call from their site?
Derrick Lathem wrote:
>
> I am trying to find a way through Perl and JavaScript to hit a site
> and save an image without having to physically hit the site, click
> save as, and so on.
>
> Basically, I am trying to display a weathermap as a .gif or .jpg on my
> site but the site that displays the current map dynamically creates
> the image, so the name is not consistent. I don't want to link to
> their site or anything easy either.
>
> I want to hit their site via a script in cron, parse out the image
> name, "grab" that image (save it on my webserver), and save it as a
> certain name. This script is actually running on a webserver.
>
> I hope this makes sense.
>
> Thanks!!
>
> Derrick Lathem
> drlathem@atlcom.net
--
Stathy Touloumis, CTO - JASKE.COM 'innovative I/net'
JASKE.COM - 3555 W. Peterson Ave. Chicago IL 60659
___________________________________________________
http://www.jaske.com - info@jaske.com - support@jaske.com
------------------------------
Date: Sat, 6 Jun 1998 16:03:08 -0400
From: "Matthew Cate" <mcate@gmu.edu>
Subject: Switching PERL scripts from UNIX to NT- Help!
Message-Id: <6lc79u$nq2@portal.gmu.edu>
This is the deal. I have written PERL scripts that take the contents of a
form and e-mail them to me using a module? called smtpsend on a shared web
hosting UNIX machine at UUNET. Okay, I'm moving the web site to an NT server
with IIS4 and Exchange 5.5 installed. I've already taken care of the PERL
installation and configured the IIS server for PERL through the MMC.
I understand that I need Blat or something similar to process my scripts
now. Can someone walk me through this with baby steps and tell me how to
rewrite my scripts to work with this program. A sample script will follow
this message. The DNS entry for my mail server takes the form of
mail.mydomainname.com as far as the Blat installation goes. I know there's
installation instructions for Blat, but there's always questions that remain
that aren't answered in the instructions.
Also, at the beginning of all my scripts is the line #! /cgi-bin/perl. I've
installed PERL to D:\perl so how should this line read now?
I also have the line require '/cgi-bin/cgi_lib.pl'; I don't have cgi_lib,
do I need it and where should I put it?
Thank you very much,
Matthew Cate
#! /cgi-bin/perl
require '/cgi-bin/cgi_lib.pl';
&ReadParse (*in);
print "Content-type: text/html\n\n";
if ($in{'name'} eq "") {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not enter your <B>name</B>. Please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI>Enter your <B>name</B>
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'email'} eq "") {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not provide your <B>e-mail address</B>. If you do not have e-mail,
please click the <B>BACK</B> button on your browser and enter <B>none</B> in
the field for e-mail. Otherwise, please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI>Enter your <B>e-mail address</B>
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'address'} eq "") {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not enter your <B>address</B>. Please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI><B>Enter your address</B> in the appropriate field
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'username1'} eq "" || $in{'username2'} eq "" ||
$in{'username3'} eq "") {
print <<EOF;
<HTML><HEAD><TITLE>Excuse Me . . .</TITLE></HEAD><BODY BGCOLOR="#FFFFFF"
TEXT="#000000" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not enter <B>three possible user names</B> on the form. Please do
the following:<P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI>Enter your choices for a <B>user name</B>
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><B><FONT SIZE=+2>Thank
You</FONT></B><P></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'password'} eq "") {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not choose a <B>password</B>. Please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI>Choose a <B>password</B>
<LI><B>Re-enter your password</B> in the appropriate field
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'passwordmatch'} eq "") {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
You did not <B>re-enter your password</B>. Please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI><B>Re-enter your password</B> in the appropriate field
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} elsif ($in{'password'} ne $in{'passwordmatch'}) {
print <<EOF;
<HTML>
<HEAD>
<TITLE>Excuse Me . . .</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000">
<CENTER><FONT SIZE="5" FACE="SerpentineDBol" COLOR="#8B0000">Excuse Me . .
.</FONT></CENTER><P><FONT SIZE="2" FACE="Arial">
Your password did not match the password you re-entered for verification.
Please do the following: <P>
<OL TYPE=1>
<LI>Click the <B>BACK</B> button on your browser
<LI>Delete the choices you made for your password and the verification match
<LI>Re-enter your password and verify it in the appropriate fields
<LI>Verify that all information is accurate
<LI>Re-submit your choices
</OL>
<CENTER><H2>Thank You</H2></CENTER></FONT></BODY></HTML>
EOF
;
} else {
open (MAIL, "|/cgi-bin/smtpsend");
print MAIL "To: myemailaddress\@mydomainname.com \n";
print MAIL "From: $in{'email'} ($in{'name'} \n";
print MAIL "Subject: MEMBERS ONLY PASSWORD REQUEST \n";
print MAIL <<EOF;
Browser: $ENV{'HTTP_USER_AGENT'}
Name: $in{'name'}
Address:
$in{'address'}
E-mail Address: $in{'email'}
User Name (First Choice): $in{'username1'}
User Name (Second Choice): $in{'username2'}
User Name (Third Choice): $in{'username3'}
Password: $in{'password'}
EOF
;
close (MAIL);
print <<EOF;
<HTML><HEAD><TITLE>Thank You</TITLE></HEAD><BODY BGCOLOR="#FFFFFF"
TEXT="#000000" LINK="#0000FF" VLINK="#FF0000" ALINK="#FF0000">
<CENTER><IMG SRC="/gifs/picture.gif"><P><H1><I><FONT FACE="TimesNewRoman"
COLOR="#8B0000">Thank You</FONT></I></H1></CENTER>
<FONT SIZE="2" FACE="Arial">
Your request for a user name and password has been received by the National
Office. The National Office will notify you by e-mail soon regarding the
status of your request.<P>
</FONT></BODY></HTML>
EOF
;
}
------------------------------
Date: Sat, 06 Jun 1998 21:51:16 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Switching PERL scripts from UNIX to NT- Help!
Message-Id: <6lcdni$l1t$2@strato.ultra.net>
[ posted and mailed ]
"Matthew Cate" <mcate@gmu.edu> wrote:
-> This is the deal. I have written PERL scripts that take the contents of a
-> form and e-mail them to me using a module? called smtpsend on a shared web
-> hosting UNIX machine at UUNET. Okay, I'm moving the web site to an NT server
-> with IIS4 and Exchange 5.5 installed. I've already taken care of the PERL
-> installation and configured the IIS server for PERL through the MMC.
My boss thought it was a brilliant idea to move off of UNIX to NT a year ago
and I still have a bad taste in my mouth but I've gotten over the spasms.
-> I understand that I need Blat or something similar to process my scripts
-> now.
Who is spreading this crap! If you installed the standard port of perl for
win32 you already have Net::SMTP installed and that is all you need. You don't
need anything fancy to send mail. The documentation for SMTP.pm is very clear
and you shouldn't have a problem configuring it.
If you have ActiveStates old version installed and you don't want to upgrade
it, you can get Net::SMTP on CPAN and install it.
-> Can someone walk me through this with baby steps and tell me how to
-> rewrite my scripts to work with this program. A sample script will follow
-> this message. The DNS entry for my mail server takes the form of
-> mail.mydomainname.com as far as the Blat installation goes. I know there's
-> installation instructions for Blat, but there's always questions that remain
-> that aren't answered in the instructions.
Blat has nothing to do with perl. If you are having a problem with Blat and
how it works, you should check the documentation and if your questions are
still unanswered try finding help in a cgi or mail newsgroup.
-> Also, at the beginning of all my scripts is the line #! /cgi-bin/perl. I've
-> installed PERL to D:\perl so how should this line read now?
That line is called a hash (#) bang (!) and tells the script the location of
the interpreter. It amazes me how many people know that it goes there but have
no clue why.
-> I also have the line require '/cgi-bin/cgi_lib.pl'; I don't have cgi_lib,
-> do I need it and where should I put it?
cgi-lib.pl is old news. You can get CGI.pm while you are at CPAN grabbing
Net::SMTP.
<<-- Billion lines of cgi script deleted -->>
Please don't post scripts in c.l.p.m. If you are having a problem with a
certain portion of your script it is ok to post that portion but not all
billion lines of it.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: Sat, 06 Jun 1998 16:09:14 GMT
From: josh@THEsyndicate-interactive.com (Joshua McAdams)
Subject: Win95 problems for Perl? Need assistance here!
Message-Id: <35796761.3293486@news.earthlink.net>
Hi there folks,
Got a couple of basic questions regarding running WinPerl. I have a
win95 laptop bought this book "Teach Yourself Perl in 21 Days" and
installed perl5 from the cd out of the back. Now when I'm writing
perl scripts in notepad, what do I save my files as? I tried .pl and
then associated them w/ the perl.exe file. When I double click on them
(the .pl files) the perl window pops up for a second, reads an error
message and then shuts down (too quicky to read the message). I left
out the path of the perl.exe file from the .pl file I wrote in notepad
because I saved it in the same directory as the perl.exe file. Should
I leave the path in? Can I make the path absolute or relative?
Do I need to use different syntax for a windows system?
Should I stick to HTML?
Thanks for all your help in advance and if anyone needs any backend
work don't hesitate to e-mail me.
Joshua McAdams
josh@syndicate-interactive.com
"You've got a company that wants to
do more business, more effectively,
we've got a company that can help."
http://www.syndicate-interactive.com
------------------------------
Date: Sat, 06 Jun 1998 15:45:06 -0400
From: David Wasserstrum <zeos@gti.com>
To: Joshua McAdams <josh@THEsyndicate-interactive.com>
Subject: Re: Win95 problems for Perl? Need assistance here!
Message-Id: <35799C42.7EC301E9@gti.com>
OK, here is a breakdown of the problem:
case 1:
If you are accessing the .pl files from a web-server (which it sounds like
you are not) then you may need to make the files .cgi files (or tell your
web server that you will be using .pl files.) If this is the case if is
also very important that the first line has the location of the perl
interpretor #/program~1/perl/perl.exe so that your web server knows what
program will interpret it.
case 2:
If you know DOS well enough you could just shell out to DOS and call the
programs as follows:
perl blah.pl
In this case it really doesn't matter what the extention is.
If you don't know DOS and want to run them stricktly out of Windows then
someone else may have a suggestion as to how to set that up. I have never
tried associating files or anything to that degree...
Joshua McAdams wrote:
> Hi there folks,
>
> Got a couple of basic questions regarding running WinPerl. I have a
> win95 laptop bought this book "Teach Yourself Perl in 21 Days" and
> installed perl5 from the cd out of the back. Now when I'm writing
> perl scripts in notepad, what do I save my files as? I tried .pl and
> then associated them w/ the perl.exe file. When I double click on them
> (the .pl files) the perl window pops up for a second, reads an error
> message and then shuts down (too quicky to read the message). I left
> out the path of the perl.exe file from the .pl file I wrote in notepad
> because I saved it in the same directory as the perl.exe file. Should
> I leave the path in? Can I make the path absolute or relative?
> Do I need to use different syntax for a windows system?
> Should I stick to HTML?
>
> Thanks for all your help in advance and if anyone needs any backend
> work don't hesitate to e-mail me.
>
> Joshua McAdams
>
> josh@syndicate-interactive.com
>
> "You've got a company that wants to
> do more business, more effectively,
> we've got a company that can help."
>
> http://www.syndicate-interactive.com
------------------------------
Date: Sat, 06 Jun 1998 13:23:37 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Joshua McAdams <josh@THEsyndicate-interactive.com>
Subject: Re: Win95 problems for Perl? Need assistance here!
Message-Id: <3579A549.1A611B5A@sirius.com>
Joshua McAdams wrote:
>
> Hi there folks,
>
> Got a couple of basic questions regarding running WinPerl. I have a
> win95 laptop bought this book "Teach Yourself Perl in 21 Days" and
> installed perl5 from the cd out of the back. Now when I'm writing
> perl scripts in notepad, what do I save my files as? I tried .pl and
> then associated them w/ the perl.exe file. When I double click on them
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is not a good way to run Perl programs in Windows. I always open
up a DOS window to get a command line and then run the program by saying
DosPrompt> perl -w program.pl
The CWD of the DOS window should the same directory where program.pl
lives. (Actually, I often run my Perl programs directly in Emacs).
Also, I highly suggest that you make sure you have the latest
version of Perl. I am running 5.004_02. It comes with a tremendous
amount of documentation and a whole slew of modules.
> (the .pl files) the perl window pops up for a second, reads an error
> message and then shuts down (too quicky to read the message). I left
> out the path of the perl.exe file from the .pl file I wrote in notepad
> because I saved it in the same directory as the perl.exe file. Should
In general, it is a very good idea to not put any of your own programs
anywhere under the /perl directory. That way you can upgrade your version
of Perl without trashing any of your own stuff. Be sure that the directory
where perl.exe lives is on your path. You can set your path by editing your
autoexec.bat file (Win95), and then rebooting.
> I leave the path in? Can I make the path absolute or relative?
Under Windows, the #!path-to-perl is not used by Windows. If you are
running an Apache Web server, you will need an absolute path such as
"#!C:/perl/bin/perl.exe" but it sounds like you are just trying to
run from the command line now. If your path is not set properly, you
can still run Perl by specifying the full path in the command line:
DosPrompt> C:\perl\bin\perl -w program.pl
> Do I need to use different syntax for a windows system?
Only if you want to run your programs under Apache or Xitami.
> Should I stick to HTML?
That's up to you.
HTH -- Jim Bowlin
------------------------------
Date: Sat, 06 Jun 1998 16:52:11 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Yes, 'No it's not' is not it (was: Yes, I think it is (was Re: No, It's Not (was Re: Yes, it is)))
Message-Id: <alecler-0606981652110001@dialup-608.hip.cam.org>
In article <6lc2aa$mnd$1@strato.ultra.net>, sowmaster@juicepigs.com (Bob
Trieger) wrote:
> Now I know who to blame when my bandwidth bill goes up.
Oh, that's original.
------------------------------
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 2802
**************************************