[15533] in Perl-Users-Digest
Perl-Users Digest, Issue: 2943 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 4 03:05:30 2000
Date: Thu, 4 May 2000 00:05:09 -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: <957423908-v9-i2943@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 May 2000 Volume: 9 Number: 2943
Today's topics:
Re: *** To retrieve remote files regularly? <PANTS.geertl@online.be>
Re: CGI and Radio buttons <godzilla@stomp.stomp.tokyo>
Re: CGI and Radio buttons jlamport@calarts.edu
Re: CGI and Radio buttons (brian d foy)
CGI.pm tactics of mistake <nospam@devnull.com>
Re: CGI.pm tactics of mistake (David Efflandt)
Re: DOS-ify / Mac-ify output files <michael.schlueter@philips.com>
Re: help! how to delete file? <lr@hpl.hp.com>
Re: How to simulate a post request ? <trw@freewwweb.com>
Re: mod_perl weaknesses? help me build a case.... <digirati777@yaloo.com>
more CGI.pm questions .. tables with nested foreach loo <nospam@devnull.com>
Re: more CGI.pm questions .. tables with nested foreach <lr@hpl.hp.com>
Re: more CGI.pm questions .. tables with nested foreach (David Efflandt)
Re: Parse a String <michael.schlueter@philips.com>
Re: Perl CGI Script Crashes on Win2K but not at Command <KidRockYou@yahoo.com>
Re: Perl CGI Script Crashes on Win2K but not at Command <jeff@vpservices.com>
Re: Reading and Writing to a file <anmcguire@ce.mediaone.net>
Re: running perl from command line interface - NT 4.0 <jamesrfr@home.com>
Re: TMTOWT set an unset variable (just for fun) jlamport@calarts.edu
Re: TMTOWT set an unset variable (just for fun) jlamport@calarts.edu
web page mailer ryanhca@my-deja.com
Re: Why won't Perl's 'use' includes the directory where <johnlin@chttl.com.tw>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 May 2000 08:46:09 +0200
From: Thorn <PANTS.geertl@online.be>
Subject: Re: *** To retrieve remote files regularly?
Message-Id: <i472hsg8ddf3q18uckdn5fu8n2m5uab0rn@4ax.com>
On Thu, 04 May 2000 00:08:27 +0800, I'm a good man
<"goodman888"@hongkong.com(remove this part)> wrote:
>BTW, which are the newsgroup for discussings PHP? I cant find one with my
>news server.....!
You crosspost to comp.lang.perl.misc but can't find a PDP ng? Weird!
------------------------------
Date: Wed, 03 May 2000 21:29:06 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: CGI and Radio buttons
Message-Id: <3910FC92.1D9A37@stomp.stomp.tokyo>
Winston Riley IV wrote:
> I have an HTML form that hast two radio buttons
> (both with name 'first' but with different values).
> Everytime I try to read in the value of this button
> using CGI, cgi-lib.pl, and $input{'first'}statement,
> I get a null string. I have tripled checked varriable
> spellings, syntax, an everything I can think of. No luck.
Sometimes effective learning can be garnished
through example. This is a simple test script
for you to test, to play with, to modify and
adapt if you wish. This test script demonstrates
the basics of using radio buttons with a Perl
based cgi script. You may upload this to your
education site, chmod 755, point your browser
to its URL "test.cgi" and observe what happens.
An quick overview is I use a homemade read and
parse routine, Akostininchi_Ithana , which
'declares' my input data in this format:
$in{Key} equals Value
Key is the NAME for my radio buttons.
VALUE will be either yes or no depending
on which button is clicked. If neither is
clicked, no input data will arrive.
Simple if, elsif, else logic is used
to grab input. Diagnostics is quite
simple; either this works or doesn't.
You will read changes in my script's
print to your screen to confirm it
is working. I have tested this script.
It runs perfect.
Change the first line to your Perl location.
Do not use strict nor -w nor 'use cgi' as
these are not needed for any reason. This
will run under both Perl 4 and Perl 5.
This is a test script, a script to play with
and from which to learn. It affords no security.
Do not simply copy and paste this into your
script without addressing basic security issues.
Look this over, test it if you like. This script
displays basic concepts in using Radio Buttons.
Godzilla!
=============
#!/usr/local/bin/perl
print "Content-Type: text/html\n\n";
print "
<HTML><HEAD><TITLE>RADIO BUTTON</TITLE></HEAD><BODY>
<BR><BR><BR>
<CENTER>
<FORM ACTION = \"test.cgi\" METHOD = \"POST\">
<INPUT TYPE = \"SUBMIT\" NAME = \"Button\" VALUE = \"TEST\"><P>
YES <INPUT TYPE=\"radio\" NAME=\"Test\" VALUE=\"yes\">
NO <INPUT TYPE=\"radio\" NAME=\"Test\" VALUE=\"no\">
</FORM>
<P><P>";
&Akostininchi_Ithana;
sub Akostininchi_Ithana
{
local (*in) = @_ if @_;
local ($i, $key, $value);
read (STDIN,$in,$ENV{'CONTENT_LENGTH'});
@in = split (/&/,$in);
foreach $i (0 .. $#in)
{
$in[$i] =~ s/\+/ /g;
($key, $value) = split (/=/,$in[$i],2);
($value eq "") && next;
$key =~ s/%(..)/pack ("c",hex($1))/ge;
$value =~ s/%(..)/pack ("c",hex($1))/ge;
$in{$key} .= $value;
}
return 1;
}
if ($in{Test} eq "yes")
{ print "Radio Button \"YES\" Was Selected"; }
elsif ($in{Test} eq "no")
{ print "Radio Button \"NO\" Was Selected"; }
else
{ print "Neither Radio Button Was Selected"; }
print "</CENTER></BODY></HTML>";
exit;
------------------------------
Date: Thu, 04 May 2000 04:39:19 GMT
From: jlamport@calarts.edu
Subject: Re: CGI and Radio buttons
Message-Id: <8equtm$qog$1@nnrp1.deja.com>
In article <3910CEC4.3D670A7F@umd5.umd.edu>,
rriley@umd5.umd.edu wrote:
> I have an HTML form that hast two radio buttons (both with name 'first'
> but with different values).
>
> Everytime I try to read in the value of this button using CGI,
> cgi-lib.pl, and $input{'first'}statement, I get a null string. I have
> tripled checked varriable spellings, syntax, an everything I can think
> of. No luck.
>
> I have many other values passing to program but they are not radio
> buttons.
>
> Any suggestions?
Are you certain that at least one of the radio buttons is checked when
the user submits the form? If none of the radio buttons are checked,
then obviously you're not going to have any value associated with the
name 'first'.
Have you looked at the raw query string? That would tell you whether the
browser is actually sending the data that you think it is.
>
> Do cgi-lib.pl not support radio buttons?
A CGI script has no way of even knowing that the input came from a radio
button. All that the script gets is a name/value pair that looks like:
first=somevalue
There's no way to tell whether 'first' is a radio button, checkbox, text
input field, hidden field, submit button, whatever... so there's no
question of a module "supporting" (or not supporting) a certain type of
input field -- this is true whether you're using cgi-lib.pl, CGI.pm, or
rolling your own.
-jason
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 02:45:44 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: CGI and Radio buttons
Message-Id: <brian-0405000245440001@187.new-york-63-64rs.ny.dial-access.att.net>
In article <3910FC92.1D9A37@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>sub Akostininchi_Ithana
> {
> local (*in) = @_ if @_;
> local ($i, $key, $value);
> read (STDIN,$in,$ENV{'CONTENT_LENGTH'});
> @in = split (/&/,$in);
> foreach $i (0 .. $#in)
> {
> $in[$i] =~ s/\+/ /g;
> ($key, $value) = split (/=/,$in[$i],2);
> ($value eq "") && next;
> $key =~ s/%(..)/pack ("c",hex($1))/ge;
> $value =~ s/%(..)/pack ("c",hex($1))/ge;
> $in{$key} .= $value;
there's a bug i haven't seen in the other bad CGI parsers.
just concatenate all of the values so you can't tell what
the original values are.
> }
> return 1;
> }
the reason that one is motivated to use CGI.pm is to avoid
these sorts of silly bugs, and, rather than waste a lot of
time reinventing square wheels, getting on with the meat of
the script.
so much for your claim that your scripts work.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 4 May 2000 04:53:57 GMT
From: The WebDragon <nospam@devnull.com>
Subject: CGI.pm tactics of mistake
Message-Id: <8eqvp5$bvp$0@216.155.32.166>
I'm currently working on a small portion of what is eventually going to
be a rather complicated script.. (see 'portion' below)
what I need to do next, is
o to set things up so that the values that are input are checked, and
limited to being in the range of 0 .. 10
o if they are out of range, I need to have a warning in the 2nd half
that not only tells the user to re-submit, but also
o disables the 2nd submit button
o uses the entered values in the original fields as the new
'defaults' (I seem to have the understanding that this is how CGI.pm
works unless I use -override switches. true?)
o makes the warning go away when the user re-submits the correct
value and re-enables the 2nd submit button.
o enters those values into the %scoresG hash for further calculation
later on in the script. (the reason why I'm not just using them straight
from param($key) is that there are TWO sets in the final project,
%scoresG and %scoresE, that have different multipliers individually and
different weightings when combined into an aggregate.)
I have yet to a second submit button below to pass on the 'accepted'
values, obviously ;)
I'm also having rather a bitch of a time getting tables to format within
the foreach thing, and the CGI.pm pod documentation is strangely lacking
some detail in the creation of tables. Either that or I'm just flat-out
blind. heh :)
-=-begin script-=-
#!perl -w
use diagnostics -verbose;
use CGI qw( :standard :html3 );
if ($CGI::VERSION < 2.66) {
warn ("Your Website's System Administrator should really update his
install of the CGI.pm module to version 2.66 or later.\n", 'The most
recent version is at http://stein.cshl.org/WWW/software/CGI/')
};
use CGI::Pretty qw( :html3 );
use CGI::Carp qw(fatalsToBrowser);
%namesList = (
fun => "Fun Factor",
play => "Playability",
bots => "Bots",
flow => "Flow",
weap => "Items",
theme => "Theme",
arch => "Architecture",
light => "Lighting",
textu => "Textures",
sound => "Sound"
);
%scoresG = (
fun => 0,
play => 0,
bots => 0,
flow => 0,
weap => 0,
);
print header;
print start_html('Input Test'),
h1('A Simple Test'),
start_form,
p;
foreach my $key (keys %scoresG) {
print "Enter your score for $namesList{$key} ",
textfield(-name=>"$key",
-default=>"$scoresG{$key}",
-size=>'3'),
"\n",
p,
};
print p,
submit(-name=>'.submit', -value=>'Click Here When Done'),
end_form, "\n",
hr, "\n";
if (param()) {
@names = param();
foreach my $key (@names) {
print "You entered: ", b(param($key)), " for ", em($key),
p,
};
hr;
}
print end_html;
-=-
any assistance appreciated as always..
Just another Perl newbie. =)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 4 May 2000 06:45:46 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: CGI.pm tactics of mistake
Message-Id: <slrn8h2754.cq9.efflandt@efflandt.xnet.com>
On 4 May 2000 04:53:57 GMT, The WebDragon <nospam@devnull.com> wrote:
>I'm currently working on a small portion of what is eventually going to
>be a rather complicated script.. (see 'portion' below)
>
>what I need to do next, is
>
> o to set things up so that the values that are input are checked, and
>limited to being in the range of 0 .. 10
>
> o if they are out of range, I need to have a warning in the 2nd half
>that not only tells the user to re-submit, but also
>
> o disables the 2nd submit button
Why print it at all if you want it disabled?
> o uses the entered values in the original fields as the new
>'defaults' (I seem to have the understanding that this is how CGI.pm
>works unless I use -override switches. true?)
You might want to set the field labels to red or otherwise mark the ones
that need to be corrected.
> o makes the warning go away when the user re-submits the correct
>value and re-enables the 2nd submit button.
Resubmission should use the same routine as the original submission, so
that should not be a problem.
> o enters those values into the %scoresG hash for further calculation
>later on in the script. (the reason why I'm not just using them straight
>from param($key) is that there are TWO sets in the final project,
>%scoresG and %scoresE, that have different multipliers individually and
>different weightings when combined into an aggregate.)
>
>I have yet to a second submit button below to pass on the 'accepted'
>values, obviously ;)
>
>I'm also having rather a bitch of a time getting tables to format within
>the foreach thing, and the CGI.pm pod documentation is strangely lacking
>some detail in the creation of tables. Either that or I'm just flat-out
>blind. heh :)
Yes, it would be nice if there were start_table() and end_table tags
(which there may be in some CGI.pm version newer than 2.42). But until
then, push the rows to a list as needed and then print the
table(Tr([@list])) at the end.
If you want to align different columns differently just use a td([]) for
each cell separated by a dot, with rows separated by a comma:
push @list,
td({align=>'right'},['Label 1']) . td([textfield('name1')]),
td({align=>'right'},['Label 2']) . td([textfield('name2')]);
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Thu, 4 May 2000 08:57:30 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: DOS-ify / Mac-ify output files
Message-Id: <8er6m8$bcn$1@porthos.nl.uu.net>
With unix there are two converting programs, dos2ux and ux2dos .
------------------------------
Date: Wed, 3 May 2000 23:10:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: help! how to delete file?
Message-Id: <MPG.137ab413d9aa20f398a9f1@nntp.hpl.hp.com>
In article <slrn8h1kcb.177.tadmc@magna.metronet.com> on Wed, 3 May 2000
21:25:31 -0400, Tad McClellan <tadmc@metronet.com> says...
> On Wed, 03 May 2000 17:03:16 -0700, james archer <snowphoton@mindspring.com> wrote:
> >perl is great, but sometimes a little to creative when naming things :o)
> >
> >somehow i think "erase" or "delete" or "rm" might have been nice...hehehe
>
> Except that unlink() does NOT "erase", "delete", nor "rm" (remove)
> the file.
... on Unix.
> So I think it is you who are too creative :-)
>
> It decrements the link count.
... on Unix.
> The file is not actually deleted until the link count gets to zero
> (to accomodate hard links).
... on Unix.
> So Perl's name is much more realistic than your suggestions.
... on Unix.
And even there, the command to do it is called 'rm', not 'unlink' or
'ul' or 'un' or whatever. I wonder why.
This question is asked often enough here that one might consider that
the FAQ titles might provide a link (ahem!) from the behavioral
description -- remove or delete -- to the specific OS implementation --
unlink.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 4 May 2000 01:05:02 -0400
From: "Todd W" <trw@freewwweb.com>
Subject: Re: How to simulate a post request ?
Message-Id: <8er0be$366$1@news.smartworld.net>
ogmandrake@my-deja.com wrote in message <8en2h8$eu0$1@nnrp1.deja.com>...
>I have been contemplating this and it seems to me that it may be
>possible to send the data using hidden fields and a redirection. You
>could include a piece of javascript into your code to send it
>automatically onLoad kinda thing.
>
The best you can do using redirection is simulating a GET request...
using the CGI module ....
print
redirect("index.cgi?day=$day&month=$month&year=$year&indmonth=false&step=ste
p2");
I had to reply because I just got done doing this.... first at deja.com
search for SIMULATE POST REQUEST. You get answers immediately. Next, get the
perl cookbook from the bookstore (or library)...page 710 ... Automating form
submission....
#!C:\perl\bin\perl.exe -w
use CGI qw/:standard/;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
<code snipped>
$ua = LWP::UserAgent->new();
my $req = POST 'http://foo.bar.com/cgi-bin/foo.cgi',[someparam =>
"$param{someparam}", another_param=> "$param{another_param];
$content = $ua->request($req)->as_string;
quotemeta($content);
$content =~ s/.*?\n\n//s;
print "Content-type: text/html\n\n$content";
I also posted because I had a question about the headers from the output of
the cgi program I POSTed to and why apache gives me a "malformed headers"
error if I dont delete them but I'll post that question in the proper ng.
------------------------------
Date: Thu, 04 May 2000 05:59:07 GMT
From: Melivin Perriwinkel <digirati777@yaloo.com>
Subject: Re: mod_perl weaknesses? help me build a case....
Message-Id: <391111F1.408DE572@yaloo.com>
Here's how to get Apache + mod_perl up easily, and in one of the stablest
configs.
(Don't read INSTALL, you want to read INSTALL.apaci )
THEN, IMPORTANT. Read down through INSTALL.apaci to the section
title 'The Flexible Way'.
Once again thats using the APACI method described in:
INSTALL.apaci - section titles 'The Flexibly Way'
(Don't just start follogin that file. skip way way down.)
This is not using DSO. This is compiling it yourself. I only work on
Solaris and Linux, and this works wonderfully on those platforms.
The Open Source approach of Apache an Perl will have fewer and much more
quickly solved stability problems than any commercial could ever dream of
approaching.
If you think otherwise then you probably need more experience with varying
approaches to software development.
mod_perl Apache is a highly stable, high-performance choice.
(You just need to write good mod_perl code, which is not hard compared to
anything else.)
Going Open Source via mod_perl Apache would be a wise choice and you would
be happy with the effect this will also have on your IT culture. Everyone
can participate in a much wider ocean of knowledge. Exciting development.
Rapid innovation.
Can't beat it for Web Serving high-volume dynamic operations.
Jim Mannix - (Not Melvin .. need to set up my Browser.)
jim@mannixdesign.com
soulhuntre@soulhuntre.com wrote:
> Hiya!
>
> Ok, we are getting ready to head out on a rather largish project, and
> it is time to settle on a set of tools.
>
> The primary issues:
>
> 1) Quick development
>
> 2) Ability to migrate easily to/from win2000 servers (Apache/win32 is
> fine)
>
> 3) Minimum arcane traps
>
> 4) Minimum destabilization of the server (Apache/IIS)
>
> From looking around the web and the mailing lists for a week or so....
> it seems to us that the following is true - but I >hope< someone can
> debunk the problems:
>
> 1) It is VERY easy to have arcane errors in mod_perl code, and that
> code is not as easily debugged as one could hope. While it seems that
> we can be very careful with our own code and avoid much of this - there
> are numerous issues about CPAN modules, that means much of the
> advantage of perl is called into question.
>
> 2) It seems that the stability of Apache is adversely effected - with
> the most common reccomendations being that the apache config should be
> tailored to restart the children every x requests to prevent memory
> creeping crud.
>
> 3) There are LOTS of posts about segfaults with bad code - this is
> scary :) It seems like the perl core has a way to go to be ready for
> this?
>
> 4) There does not seem to be a compatible win32/linux modperl/embedding
> toolkit. I can use modperl/apache/::ASP under linux, but the same setup
> does not seem stable under win32 - and the activestate ASP perlex stuff
> does not seem completely compatible.
>
> Thanks for any light you can shed - or pointers to discussions on these
> issues!
>
> Ken
> soulhuntre@soulhuntre.com
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 4 May 2000 05:39:34 GMT
From: The WebDragon <nospam@devnull.com>
Subject: more CGI.pm questions .. tables with nested foreach loops .. how?
Message-Id: <8er2em$i1k$0@216.155.32.166>
this is making me crazy : )
print table,
foreach my $key (keys %scoresG) {
print tr;
print td({-align=>'right'}, textfield(-name=>"$key",
-default=>"$scoresG{$key}", -size=>'3');
print td({-align=>'left'}, " Enter your score for $namesList{$key}");
};
gives me a syntax error 'near foreach'
I guess I just don't know enough about perl, but even
print table({-border=>undef},
foreach my $key (keys %scoresG) {
print tr;
print td({-align=>'right'}, textfield(-name=>"$key",
-default=>"$scoresG{$key}", -size=>'3');
print td({-align=>'left'}, " Enter your score for $namesList{$key}");
});
fails for the same reason.
how do I do this correctly and still get the output I want ?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Wed, 3 May 2000 23:45:40 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: more CGI.pm questions .. tables with nested foreach loops .. how?
Message-Id: <MPG.137abc6da7bd33a498a9f2@nntp.hpl.hp.com>
In article <8er2em$i1k$0@216.155.32.166> on 4 May 2000 05:39:34 GMT, The
WebDragon <nospam@devnull.com> says...
> this is making me crazy : )
>
> print table,
> foreach my $key (keys %scoresG) {
> print tr;
> print td({-align=>'right'}, textfield(-name=>"$key",
> -default=>"$scoresG{$key}", -size=>'3');
> print td({-align=>'left'}, " Enter your score for $namesList{$key}");
> };
>
>
> gives me a syntax error 'near foreach'
Statements end in semicolons, not commas.
print table;
But even then, there will be another, subtler error, because 'tr' is a
Perl keyword. You will need to use:
print Tr;
instead.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 May 2000 06:53:56 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: more CGI.pm questions .. tables with nested foreach loops .. how?
Message-Id: <slrn8h27ke.cq9.efflandt@efflandt.xnet.com>
On 4 May 2000 05:39:34 GMT, The WebDragon <nospam@devnull.com> wrote:
>this is making me crazy : )
You cannot put perl commands within a table(), but the table rows are a
list, so you can easily push dynamic rows to a list and then print the
table:
foreach my $key (keys %scoresG) {
push @rows, td({-align=>'right'}, textfield(-name=>"$key",
-default=>"$scoresG{$key}", -size=>'3'),
td({-align=>'left'}, " Enter your score for $namesList{$key}");
};
print table(Tr([@rows]));
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Thu, 4 May 2000 09:06:52 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: Parse a String
Message-Id: <8er77q$bkt$1@porthos.nl.uu.net>
Hey guys,
You won ;-))
Michael Schlueter
------------------------------
Date: Thu, 04 May 2000 05:31:34 GMT
From: "John" <KidRockYou@yahoo.com>
Subject: Re: Perl CGI Script Crashes on Win2K but not at Command
Message-Id: <WW7Q4.26611$g4.661375@newsread2.prod.itd.earthlink.net>
Well, I looked at 3 books and none of them could answer my question. That's
really sad to think, considering these books are like 600 pages each.
HEEEEELLLLLPP
John
------------------------------
Date: Wed, 03 May 2000 23:26:26 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl CGI Script Crashes on Win2K but not at Command
Message-Id: <39111812.17E90F39@vpservices.com>
John wrote:
>
> Thanks for this help Sam. From what you've said and what I learned is that
> is the IUSR_ is not a local user, thefore it has no right to the machine.
> The problem that I now encounter, is when I give the IUSR_ right's to the
> databases, it still doesn't seem to matter.
>
> If I change the the Web Site user I can acomplish this, however, I can only
> do so by changing this to Administrator from IUSR_, something that can't be
> a good idea.
Ok, so it looks like you have identified the key componenet of the
problem: user permissions. I'm afraid I know next to nothing about user
permissions in a win environment. I suggest you ask in windoze related
newsgroups about that and especially about how to create users who can
access the database but who aren't administrators. The other
componenent is how to get the script to behave as a given user. I
suggest you ask in CGI newsgroups about how you can authenticate a user
via CGI and then give them rights needed to do what they need to do.
Sorry for only giving you pointers to other places, but both of those
issues are fairly complex and not ones usually discussed in this
newsgroup. We aren't trying to brush you off, it's just that other
groups will have better answers for you.
Good luck!
--
Jeff
------------------------------
Date: Wed, 03 May 2000 23:30:04 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: Reading and Writing to a file
Message-Id: <3910FCCC.99889CE0@ce.mediaone.net>
Larry Rosler wrote:
>
> In article <39109ABB.1006C5E6@walgreens.com> on Wed, 03 May 2000
> 16:31:39 -0500, Andrew N. McGuire <andrew.mcguire@walgreens.com> says...
> > "Godzilla!" wrote:
>
> ...
>
> > > Here is a simple test script you may
> > > modify and adapt if you wish. It can
> > > be run from the internet if needed by
> > > uploading my script and by uploading a
> > > test.txt with contents as shown with
> > > read and write permissions on.
>
> ...
>
> > > print "Content-Type: text/plain\n\n";
> >
> > Why?
>
> See above. The troll wants the program to be runnable from the
> Internet. I would do it this way, though:
>
> print "Content-Type: text/plain\n\n" if $ENV{REQUEST_METHOD};
Good point. I guess I went a little too far.
I really replied to the trolls post too quickly after
reading it.
> > > $newstuff = "append this";
> > >
> > > open (TEST, "+<test.txt");
> >
> > No diagnostic? How will you know if the open() was successful?
> > Also it is generally accepted that there should be no white
> > space before the leading paren of a function call.
>
> I don't use a leading paren there at all. But I think 'generally
> accepted' is a throwback to the Bad Old Days when cpp(1) couldn't
> recognize a macro with arguments if the invocation had a space before
> the leading paren. Compared to the rest of this farrago, it is a
> sylistic nit on a pile of shit.
Actually, I was just referring to the perlstyle documentation:
"No space between function name and its opening parenthesis."
But you are correct, it is stylistic nit-picking. I just get
a little disjointed when the troll posts such blatant crap.
I also generally use no parens, I avoid them if feasible.
> > > @Test = <TEST>;
> >
> > Why, this model does not scale well for large files.
> > Use 'while (<TEST>) { ... }' instead.
> >
> > > foreach $test_line (@Test)
> >
> > This would not be necessary had you used 'while' instead.
>
> You missed the point, which is to do an 'in situ' modification of the
> file. You'd better slurp it all before rewriting.
I would use '-pi.bak' in this case, and pass the filename
as an argument, if this meets the OP's specs.. If not
Godzilla's way was is right, slurp it. Arrgh, oh well.
> ...
>
> > > chomp ($test_line);
> >
> > You remove the "\n" ...
> >
> > > $test_line = join (" ", $test_line, $newstuff, "\n");
> >
> > Only to put it back on...
>
> In a different place.
[ snip ]
Correct, I plead aggravated troll-response syndrome.
[ snip ]
> > > exit;
> >
> > Why, it would have happened anyway. Maybe you
> > mean 'exit(1)', becuase this script is one big
> > error.
>
> Yes. Too bad I have to add your few errors to the troll's gross
> misfeasance.
Misfortunate indeed, that in my trying to correct the trolls
post, I was suckered by it, lost my better sense, and added to
the error count.
Regards,
anm
--
Andrew N. McGuire
anmcguire@ce.mediaone.net
------------------------------
Date: Thu, 04 May 2000 05:14:50 GMT
From: james <jamesrfr@home.com>
Subject: Re: running perl from command line interface - NT 4.0
Message-Id: <39110743.37046C64@home.com>
Paul Spitalny wrote:
>
> Hi,
> I have successfully installed activeware perl. I appended the path
> variable on my system ton incoude the directory where all my perl
> scripts live. Then I did this:
>
> ASSOC .pl=PerlScript
> FTYPE PerlScript=[full path to perl]\perl.exe %1 %*
>
> fred 2 2 (where 2 and 2 are the args passed by $ARGV[0] and $ARGV[1])
You need to include .PL in the PATHEXT environment variable. Do it in
the system portion and you'll be happier longer! ;vD
------------------------------
Date: Thu, 04 May 2000 04:17:30 GMT
From: jlamport@calarts.edu
Subject: Re: TMTOWT set an unset variable (just for fun)
Message-Id: <8eqtke$p85$1@nnrp1.deja.com>
In article <3910DEDB.E327B68@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
> Donald Lancon wrote:
> ...
> > $foo = "dog" unless $foo; # or "if not $foo", or "if ! $foo"
> > if (not $foo) { $foo = "dog" } # or "if (! $foo)", or "unless ($foo)"
> > $foo or $foo = "dog"; # or use "||" with parentheses
> > not $foo and $foo = "dog"; # or "! $foo", or "&&" with paren's
> > $foo = $foo ? $foo : "dog"; # I like this one :-P
> > $foo = $foo || "dog";
> > $foo ||= "dog"; # didn't think of this till I RTFM :-)
> ...
> > What other "neat" ways of doing it haven't I thought of?
> ...
> > Donald Lancon
>
> Well, there's:
>
> $foo?0:($foo='dog');
>
> --
> Bob Walton
>
$foo =~ s/^(.*)$/$1?$1:'dog'/se;
or there are obvious options like:
$_='Boredom, The Root of All Evil';
tr!ARTrBEfh,dmt o+evil!g'|f$'o=|ood!d;
eval;
or what about:
$_='nada';y/and/odg/;${join'',reverse chop,o,f}||=$_;
I'm sure these could all be... uh... "improved" on ;)
-jason
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 05:09:47 GMT
From: jlamport@calarts.edu
Subject: Re: TMTOWT set an unset variable (just for fun)
Message-Id: <8er0mj$sii$1@nnrp1.deja.com>
In article <3910CF23.5D6E6388@mail.ce.utexas.edu>,
Donald Lancon <lancon@mail.ce.utexas.edu> wrote:
>
> I'm interested in short, "simple" -- although not necessarily obvious --
> solutions. That is, I'm not looking for an Obfuscated Perl Contest
> winner. :-)
>
Oops. The first time through, I just skimmed that paragraph, saw
"Obfuscated Perl Contest winner" and somehow thought you *were* asking
for a few obfuscated examples, just for fun...
So ignore my previous post :)
(I was wondering why all the follow-up suggestions were so... boring... )
-jason
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 03:58:19 GMT
From: ryanhca@my-deja.com
Subject: web page mailer
Message-Id: <8eqsgk$nub$1@nnrp1.deja.com>
Does anyone know of a script out there that can find a grab a web page
(even over SSL) and then mail it to an email address?
I could write it myself, but don't have time, and I think I'd be
reinventing the wheel... not that novel a concept :)
Any help out there?
Thanks
Ryan Huff
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 4 May 2000 14:25:32 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Why won't Perl's 'use' includes the directory where script is run?
Message-Id: <8er56k$jeh@netnews.hinet.net>
Tom Phoenix wrote
> On Thu, 4 May 2000, John Lin wrote:
> > BEGIN { chdir '/test/here' or die $! }
> > use Part1;
> > use Part2;
> > It works. But, isn't it ugly?
> Do you mean the one where your program happens to be stored?
> If that's it, maybe you want FindBin.
Wow, great!!! Now my program looks like:
use FindBin;
use lib $FindBin::Bin;
use Part1;
use Part2;
And it is exactly what I wanted.
FindBin also solved another problem I was planning to ask:
@ARGV or die "Usage: $0 file-list\n";
$0 will include the whole path name which I don't like.
Now I can solve it by:
@ARGV or die "Usage: $FindBin::Script file-list\n";
Thank you very much!!!
John Lin
------------------------------
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 2943
**************************************