[10575] in Perl-Users-Digest
Perl-Users Digest, Issue: 4167 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 6 15:07:16 1998
Date: Fri, 6 Nov 98 12:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 6 Nov 1998 Volume: 8 Number: 4167
Today's topics:
[Fwd: IIS4, Perl, Object Moved] <sysop@scbbs.com>
Re: Array Problems... <jdw@dev.tivoli.com>
Re: BIZARRE -- Perl vs C for Y2K <tterry@pbi.net>
Re: BIZARRE -- Perl vs C for Y2K (I R A Aggie)
Re: BIZARRE -- Perl vs C for Y2K <mgregory@asc.sps.mot.com>
Re: CGI and Server Loads <mcolbert@netgenics.knowspaaaamm.com>
creating a relocatable perl binary? <sr@pc-plus.de>
Re: customizable users mail in perl <garethr@cre.canon.co.uk>
Re: Help on $^0... <uri@fastengines.com>
Re: Help on $^0... <r28629@email.sps.mot.com>
Re: Need Perl help on which 'box'. <r28629@email.sps.mot.com>
OLE Sub routine scalar assignment problem (John Hardy)
Re: Opening many files. (Clinton Pierce)
Re: Processing form <perlguy@technologist.com>
Re: Processing form <Allan@due.net>
Re: readdir bug in win95 perl 5.00402? - test script <dtbaker-@busprod.com>
readdir bug in win95 perl 5.00402? <dtbaker@-busprod.com>
Re: REMOTE_USER <mcolbert@netgenics.knowspaaaamm.com>
Re: Script calling Remote Script <garethr@cre.canon.co.uk>
Re: Sendmail-code needed <ours@casema.net>
Shared CGI.pm from various directories bill_mcintyre@my-dejanews.com
Re: Tk on NT (Mark Tagawa)
Re: what does split do on empty fields? (John Klassa)
Re: What is the "correct" location of perl under Solari <mgregory@asc.sps.mot.com>
Re: windows nt user32.dll initialization and perl matt@ohionet.org
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 06 Nov 1998 18:01:27 GMT
From: Ron Parker <sysop@scbbs.com>
Subject: [Fwd: IIS4, Perl, Object Moved]
Message-Id: <36433976.B12B1C29@scbbs.com>
This is a multi-part message in MIME format.
--------------9F214769BEAB56BE2DD63176
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
--------------9F214769BEAB56BE2DD63176
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-ID: <36433667.119B2C7A@scbbs.com>
Date: Fri, 06 Nov 1998 09:48:24 -0800
From: Ron Parker <sysop@scbbs.com>
Organization: Software Creations
X-Mailer: Mozilla 4.05 [en] (Win95; I)
MIME-Version: 1.0
To: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>,
comp.lang.perl.misc@scbbs.com
Subject: Re: IIS4, Perl, Object Moved
References: <3641716D.53FA3B71@scbbs.com> <71s4dk$ue5$1@news.cegelecproj.co.uk> <3642B4FE.C3A040B7@scbbs.com> <199811061420.OAA09699@vampire.cegelecproj.co.uk>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I'm sorry if I seem too vague. I'll try to outline precisely what I am doing and
precisely what is happening.
Steve Kilbane wrote:
> [ Copy emailed ]
>
> In article <3642B4FE.C3A040B7@scbbs.com>, Ron Parker <sysop@scbbs.com> writes:
> > IIS is returning the "Object Moved" message as a reponse to the "POST" request
> > sent by the script.
>
> Ok.
>
> > The URL in the POST request is correct. A similar program works on another Unix
> > machine running an older NCSA www server and Perl 4.x.
>
> Be specific here. Let's say your browser is on machine B, your Apache server
> on machine U (unix) and IIS on machine W (windows). This other server - would
> that be an alternative to W that U can talk to, or an alternative to U that can
> talk to W?
>
The other server is an alternative to U that can talk to W. It runs the older NCSA
www server and does not barf when it doesn't see an output header and does
successfully call up the URL from the IIS4 web server.
>
>
> > If I do print
> > it, the IIS response to the POST request is "Object Moved". Any ideas?
>
> Which status code are you giving in your response header on the Windows
> machine? Is it a plain 200, or are you not specifying? I've seen IIS completely
> ignore the response provided, because it decided that it knew how to handle
> the status code itself...
>
The script is not sending anything to the IIS4, once the connection is made on socket
80, other than the "GET" request below.
> Also, are you including Location: or URL: headers in your response? Those
> will cause IIS to decide that what you *really* meant was that the object
> had moved...
>
The script only sends the "GET" request to IIS4.This is the significant section of the
code here:
1 print "Content-type: text/html";
# I need this so that the Apache server (running this cgi-bin script) does not return
a
#"malformed header" error.
2. &open_connection (HTTP, $host, $service);
#this subroutine is in required "sockets.pl".
#$host = "nt.scbbs.com"
#$service="80"
3. print HTTP "GET $file HTTP/1.0\n\n";
#$file="/cgi-bin/om_isapi.dll?" This is all I am sending to IIS4 server from Unix
server.
#Same response if I use "POST" instead of "GET".
4. while (<HTTP>) {
5. $outputline = $_;
6. print "$outputline";
# This prints the response from the IIS4 server. It is always "Object Moved".
7. }
8. close (HTTP);
> steve
> --
> <Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
> IIS4+Perl5 FAQ: http://www.whitecrow.demon.co.uk/steve/iis4.html
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
--------------9F214769BEAB56BE2DD63176--
------------------------------
Date: 06 Nov 1998 11:05:21 -0600
From: Jim Woodgate <jdw@dev.tivoli.com>
Subject: Re: Array Problems...
Message-Id: <obk918g3am.fsf@alder.dev.tivoli.com>
"Ray A. Lopez" <rdsys@inficad.com> writes:
> I have defined an array of invalid names as such.
>
> @invalid_names = {"AH", "T/R", "BUSY", "SPARE", "ADDRESS", "RESERVED",
> "SUBADDRESS"};
> I want to parse a file for some word patterns. These invalid words
> happen to match my word pattern and want to exclude them.
You should always use perl -w, which would have flagged this line for
you.
You want
@invalid_names = (...);
not
@invalid_names = {...};
(there has been a similar thread running around clpm)
@invalid_names is being set to a reference to an anonymous hash, not a
list.
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: Fri, 06 Nov 1998 09:48:51 -0800
From: Troy Terry <tterry@pbi.net>
Subject: Re: BIZARRE -- Perl vs C for Y2K
Message-Id: <36433683.B0220308@pbi.net>
I R A Aggie wrote:
>
> In article <36423255.830DF16@pbi.net>, Troy Terry <tterry@pbi.net> wrote:
>
> + Year 0 (1900) -- Epoch: 946713600 # Surprising (and wrong)
>
> My results:
>
> Year=0, Epoch=946702800 Year=1900, Epoch=-1
>
Note from my original post that the Epoch for Year=100 also
gives back 946702800. Why is timelocal() for 1900 equal to
that of 2000? Am I missing some key point here? Ay, pobre
de mi!
> from:
>
> use Time::Local;
[... snip code ...]
>
> When given a fully qualified year -- 1900, in this case, it does the
> correct thing -- the epoch time is out-of-range. The documentation is
> a bit sparse on _what_ values should be fed to this routine.
>
The documentation for timelocal says to look at localtime for the
meaning of the arguments. The localtime documentation explicitly
states that the year passed in is (real year) - 1900. So "Year 0"
is 1900, and that is why I was very surprised that "Year 0" gave
the same result as "Year 100".
> + Year 138 (2038) -- Epoch: -1 # Surprising (and wrong?)
> + Year 139 (2039) -- Epoch: -1
>
> Surprising only if you haven't read the documentation for Time::Local,
> which states:
>
> Both routines return -1 if the integer limit is hit. I.e.
> for dates after the 1st of January, 2038 on most machines.
>
The reason I thought "Year 138" was surprising is that in the C example
Year 138 gives back a good value and in perl it does not. I had
(unwisely, perhaps) assumed that I would get the same results, and
that "Year 138" would be okay, but "Year 139" would give -1.
It seems very unlikely that the number of seconds between 1/1/1970 and
1/1/2038 is an exact power of two. In C we die somewhere into the year
2038. So... is perl cutting off arbitrarily at 1/1/2038 instead of when
an overflow is about to happen?
That is what I am looking into. I imagine that the advent of 64-bit
systems will obviate the whole issue, however, as has been pointed
out to me in email.
Thanks for writing! Yours,
T. Terry
------------------------------
Date: Fri, 06 Nov 1998 14:17:47 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: BIZARRE -- Perl vs C for Y2K
Message-Id: <fl_aggie-0611981417470001@aggie.coaps.fsu.edu>
In article <36433683.B0220308@pbi.net>, Troy Terry <tterry@pbi.net> wrote:
+ Note from my original post that the Epoch for Year=100 also
+ gives back 946702800. Why is timelocal() for 1900 equal to
+ that of 2000? Am I missing some key point here? Ay, pobre
+ de mi!
On this point, I'm confuzzled myself.
+ > When given a fully qualified year -- 1900, in this case, it does the
+ > correct thing -- the epoch time is out-of-range. The documentation is
+ > a bit sparse on _what_ values should be fed to this routine.
+ The documentation for timelocal says to look at localtime for the
+ meaning of the arguments.
Really? what version do you have? My 'perldoc Time::Local' returned
a high-level overview of the functionality provided. Time to peruse
the Camel, I think. <dig><dig><dig> ahhhh...I see.
+ The reason I thought "Year 138" was surprising is that in the C example
+ Year 138 gives back a good value and in perl it does not.
Hmmm...especially since your test occurs in early January of each year
tested, which is before the 32bit time problem strikes.
Way confused,
James
------------------------------
Date: 06 Nov 1998 14:30:38 +1030
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: BIZARRE -- Perl vs C for Y2K
Message-Id: <r8lnlpii6x.fsf@asc.sps.mot.com>
Troy Terry <tterry@pbi.net> writes:
> Hi...
>
> I have run some tests and get results that I have trouble
> explaining. Look at this Perl script, "tiempo.pl":
> ---------------------------------------------
> #!/usr/local/bin/perl
>
> require 'timelocal.pl';
>
> @yearArray = (70,71,98,99,100,0,101,102,137,138,139);
>
> $second = 0;
> $minute = 0;
> $hour = 0;
> $dayofmonth = 1;
> $month = 0; # months SINCE January
> foreach $yr (@yearArray)
> {
> $epoch = timelocal($second, $minute, $hour, $dayofmonth, $month,
> $yr);
> printf("Year %4d (%4d) -- Epoch: %12ld\n", $yr, (1900+$yr),
> $epoch);
> }
> ---------------------------------------------
> This gives the following output (note that for year 70
> we get 28800 instead of 0, because we are factoring in
> PST time zone(28800=8*3600)):
> rhino [322] tiempo.pl
> Year 70 (1970) -- Epoch: 28800
> Year 71 (1971) -- Epoch: 31564800
> Year 98 (1998) -- Epoch: 883641600
> Year 99 (1999) -- Epoch: 915177600
> Year 100 (2000) -- Epoch: 946713600
> Year 0 (1900) -- Epoch: 946713600 # Surprising (and wrong)
> Year 101 (2001) -- Epoch: 978336000
> Year 102 (2002) -- Epoch: 1009872000
> Year 137 (2037) -- Epoch: 2114409600
> Year 138 (2038) -- Epoch: -1 # Surprising (and wrong?)
> Year 139 (2039) -- Epoch: -1
In short, read the documentation of timelocal().
It returns the integer number of seconds since Jan 1 1970. Bit unfair
to feed it times before then.
And, as the last sentence in the documentation says, it returns -1 if
the integer limit is hit. On a 32bit machine this is 1 Jan 2038.
This is not considered to be a Y2K style bug because "by 2038 all
machines will be 64 bit" (rendered in quotes because this is what I
have heard, not what I believe or do not believe!)
HTH.
Martin.
------------------------------
Date: Fri, 06 Nov 1998 19:49:49 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: CGI and Server Loads
Message-Id: <36436197.5C8C1ECC@netgenics.knowspaaaamm.com>
no! mod_perl was designed specifically to make your web server LESS
efficient, therefore INCREASING your server load. seriously though,
mod_perl is an apache module, not a perl module. you should check with a
group that talks about apache. :-)
gabriel@communitech.net wrote:
> Does anyone have any experience with the effect of mod_perl
> on the server loads, especially if the server is handling quite
> alot of CGI processes?
>
> Our server loads are significant and it appears that mod_perl
> is the answer. Theoretically, it should help with the load
> averages. Can anyone speak for it in practice?
>
> Does mod_perl make CGI run more efficiently and reduce the
> server load averages?
>
> Any feedback is appreciated.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 06 Nov 1998 18:58:02 +0100
From: Stephen Riehm <sr@pc-plus.de>
Subject: creating a relocatable perl binary?
Message-Id: <364338AA.167E@pc-plus.de>
Hi JAPH's,
Perl has but one drawback - it's not delivered with commercial *nixen
yet. We have started delivering perl scripts with our products, which
means we also need to be able to deliver perl to the customers. The
problem is that the machines we install our software on don't have
compilers, and their managers are very picky about what software
goes where, meaning we have to recompile perl and install the
modules we need again and again and again..... - there must be a
better way :-)
So, what I'ld really like to do is compile perl in such a way that
the @INC path's etc aren't hardcoded, but instead that the location
of the perl binary be induced from $0, and @INC set relative to that.
This way, modules could be found even if the perl tree was moved to
some really obscure location - the scripts of course would be
patched up with fixin(1). (then we would simply have a tar file
of the binaries for each platform, and install perl whereever our
customer wants it)
The perl routine I worked out to do this was about 100 lines long,
but catered for all manner of disgusting things like symbolic links
in paths etc.
Would it be possible to build this sort of code into perl itself,
so that @INC always appears relative to the directory in which
perl is standing (unless the installer configured the lib directory
to be somewhere else)??
I've already written the code to do the "finding" of a binary, (in C
and perl), but having never looked at the guts of perl, I'ld rather
not create a special version of perl which is no longer the same as
the perl from the net (some customers actually have perl installed).
Are there others that could benefit from this addition to perl?
(I'll happily post the code if one of the perl-developers would like
to try it)
Thanks in advance,
Steve
// __________________________ ._ o ________________________________
\\\\ Stephen Riehm / //\. Stephen.Riehm@pc-plus.de
//// pc-plus ' \>> | Phone: +49 89 45566 148
\\ 81675 Munich, Germany \\ ` Fax: +49 89 45566 113
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2
mQCNAjWaUeoAAAEEAMSI/hFLWlcAFVSwMHdHFiSbXP+IfbDzHg1IUSjlGseTsi5o
kxDRFjvpxJUpH8S4XHbVAkyAMyysNaBI/LxuCvS66WiMINzJTxeDMJCUnzGpLcQH
h/Co2ymaw0KnjHJtBvFAptntu8wgEM712cU0LSdoD25x1faWDDlT6pxFM0BlAAUR
tChTdGVwaGVuIFJpZWhtIDxTdGVwaGVuLlJpZWhtQHBjLXBsdXMuZGU+
=+MnD
-----END PGP PUBLIC KEY BLOCK-----
------------------------------
Date: Fri, 6 Nov 1998 17:51:55 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: customizable users mail in perl
Message-Id: <sid870pv44.fsf@cre.canon.co.uk>
Moshe Bar-Nachoom <mosheb@duridium.com> wrote:
> I tried to spawn subroutine that sends mail so the main program will
> finish quick, and let the server worry about the rest, but fork ran my
> program endlessly, ever spawning new mail messages.
This is the right approach, you just need to make sure that you're using
`fork' properly. Try reading `perldoc -f fork' and `perldoc perlipc'
for some hints. Chapter 16 of the "Perl Cookbook" is good too.
When using `fork', don't forget to
1. check the return code: undef means that the fork has failed, 0
means that you're in the child process, and >0 means that you're in
the parent;
2. make sure the child process exits after it's done its work; you
don't want it suddenly thinking it's the parent again and starting
to fork some children of its own;
3. use `wait' or `waitpid' to reap the child processes.
--
Gareth Rees
------------------------------
Date: 06 Nov 1998 13:34:43 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Help on $^0...
Message-Id: <sarbtmkbrgc.fsf@camel.fastserv.com>
>>>>> "TS" == Tk Soh <r28629@email.sps.mot.com> writes:
TS> [posted to comp.lang.perl.misc and copy emailed]
TS> Rusty Williamson wrote:
>>
>> Why doesn't print "$^0"; work? Why do I have to use print eval "$^O";?
>>
TS> I don't remember how many I had stumbled over 0 (zero) and O (O as is
TS> OS). The solution, use editors that can differentiate between O & 0 (See
TS> that??).
i first ran into that problem in 1974 debugging someone else's program
in PL/I using line printer output and punch card input. a variable cross
reference showed two variables that looked the same. the printer font
didn't differentiate 0 and O very well.
dated,
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 06 Nov 1998 12:05:42 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Rusty Williamson <rwilliamson@uno.gers.com>
Subject: Re: Help on $^0...
Message-Id: <36433A76.5D06EE17@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
Rusty Williamson wrote:
>
> Why doesn't print "$^0"; work? Why do I have to use print eval "$^O";?
>
I don't remember how many I had stumbled over 0 (zero) and O (O as is
OS). The solution, use editors that can differentiate between O & 0 (See
that??).
Have fun.
-tk
------------------------------
Date: Fri, 06 Nov 1998 11:53:48 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Rusty Williamson <rwilliamson@uno.gers.com>
Subject: Re: Need Perl help on which 'box'.
Message-Id: <364337AC.341EADFD@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
Rusty Williamson wrote:
>
> My Perl scripts need to know what they are running on. Does anyone know of
> a Perl function which will return the platform and/or OS version it is
> running on (i.e. Windows 98 [Version 4.10.1998], Windows NT Version 4.0,
> Linux 2.0.30, DG/UX Release R4.11MU04 AViiON, etc)?
>
perldoc Config
This module works pretty well on my Unix boxes (Sun & HP) but I haven't
tried it on other system, especially Windows xxx.
Don't forget to let me know how it works out on these machine, if you
ever try of course.
-tk
------------------------------
Date: Fri, 06 Nov 1998 17:27:51 GMT
From: jhardy@cins.com (John Hardy)
Subject: OLE Sub routine scalar assignment problem
Message-Id: <rkG02.5$sF2.15570@198.235.216.4>
The problem I am having below is when the script reaches:
$CMD->ActiveConnection=$Conn;
PERL complains "Can't modify subroutine entry in Scalar assignment at line 95
near "$Conn;" "
I don't understand?? Can anyone tell me the proper way to do this??
foreach $key (sort keys %linesin ) {
$value=$linesin{$key};
$key=join('.',$TableName,$key); ##add the table name to the
field name (may not need this)
print "$key\t$value\n"; ## here for debugging purposes
};
DB_connect(%linesin);
sub DB_connect {
use OLE; ## Start communications with
SQL
$Conn = CreateObject OLE "ADODB.Connection";
$Conn->Open("DSN=iHRS;UID=sa;PWD=");
$CMD->ActiveConnection=$Conn; ## Set new object in ADODB
called Command into currently
## open connection object $Conn
$CMD->CommandText="CandidateINS"; ## set CommandText attribute of
Command object into
## CandidateINS procedure
$CMD->CommandType=1; ##set command type attrib. into
command object into 1
$CMD->Parameters("fname")=$linesin{$fname}; ## set each parameter of
Command Object seperately
$CMD->Parameters("lname")=$linesin{$lname};
$CMD->Parameters("address")=$linesin{$address};
$CMD->Parameters("po_box")=$linesin{$po_box};
$CMD->Parameters("city")=$linesin{$city};
$CMD->Parameters("province")=$linesin{$province};
$CMD->Parameters("postal_code")=$linesin{$postal_code};
$CMD->Parameters("country")=$linesin{$country};
$CMD->Parameters("telephone")=$linesin{$telephone};
$CMD->Parameters("ext")=$linesin{$ext};
$CMD->Parameters("fax")=$linesin{$fax};
$CMD->Parameters("email")=$linesin{$email};
$CMD->Parameters("citizen_ship")=$linesin{$citizen_ship};
$CMD->Parameters("citizen_status")=$linesin{$citizen_status};
$CMD->Parameters("comment")=$linesin{$comment};
$RS=$CMD->EXECUTE;
$RS->Close;
$Conn->Close;
print "$RS\n";
}
------------------------------
Date: Fri, 06 Nov 1998 19:07:51 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Opening many files.
Message-Id: <3644472a.11422855@news.ford.com>
[courtesy cc sent by E-Mail]
On 6 Nov 98 17:09:26 GMT, J.Horne@plymouth.ac.uk (John Horne) wrote:
>Hello,
>
>I have a program - okay a CGI script - which opens a lot of files. By
>a lot, this is anything from 1 I guess to about 4000. The program looks
>in each file and does a bit of processing; the files are not changed.
>This works fine up to the 97th file - with 97 files I get a response
>from the system in about 3 seconds. Above this - even just by 1 file-
>and I wait for ages. Initially the HTML server was timing out, so I
>upped the timeout to 32000 seconds. After waiting 10 minutes for a
>response I gave up. I have set $| for the standard output. I have
>tried putting print statments in too see how far the program gets,
>but it seems that these are not printed - the system seems to
>be waiting for something (or something to be unlocked). The files
>are all in the same directory, and opened/closed with the perl
>builting open/close statements.
>
>This is on a Sun Ultra 1/170, Solaris 2.5.1, perl 5.005, and
>apache 1.2.1. I have tried it at home, and it all works well -
>RedHat linux 5.1, perl 5.005, apache 1.3.
Ok, there are a lot of potential problems here:
* Have you actually tried running this interactively? (NOT
WITH CGI). Do your diagnostics print then? Running CGI
programs interactively is a GREAT way to debug them.
* Are you SURE you're closing all of the file descriptors?
File opening to just "stop working" at a certain point just
cries out "File Descriptor Leak".
* You're tempting fate, it seems, opening/closing 4000 files
in a CGI script. The time necessary to do that could very well
exceed Apache or your Browser's patience.
* Are you printing (to the browser) an error message if open()
doesn't return correctly? Are you sure your error message works?
If you've run out of file handles, and open() fails, and your
error reporting isn't any good, it would appear to just stop.
* Is the process hung, or dead? If it's stuck, have you run
"truss" against it to see what system calls are sticking?
If it's dead, run it interactively (and make sure all of your
system calls have error messages) to see what's really going on.
Segfaults? No more descriptors? What?
------------------------------
Date: Fri, 6 Nov 1998 17:07:42 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Processing form
Message-Id: <36432CDE.D0A486B1@technologist.com>
Larry Rosler posted a response to this thread. I am responding to it
_before_ it got to the group because I have it up on my e-mail and the
code is in front of me.
He stated:
Is it __that__simple really? Isn't there a problem here with barewords
that '-w' would complain about?
I am testing on an NT box, but just for proof that __My__ example works
on __my__ system, here is my code:
#!/usr/bin/perl -w
use CGI qw /:standard/;
$email = param(email);
$msg = param(message);
$subj = param(subject);
print header;
print "<PRE>";
print "E-mail: $email\n";
print "Msg: $msg\n";
print "Subj: $subj\n";
#### END OF CODE
And here is the output I get:
E-mail: e-mail here
Msg: this is the message
Subj: and I am the subject
I know that the output, etc. is not pretty, I was just checking to make
sure it worked...
Sooooo, since it seems to work without any errors or warnings, I can
safely say that my original post was correct __on NT systems__.
Anynone have a unix system to test this on? I can't test it on UNIX
until I get home...
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Fri, 6 Nov 1998 14:37:47 -0500
From: "AmD" <Allan@due.net>
Subject: Re: Processing form
Message-Id: <71viu5$ja5$1@camel21.mindspring.com>
Brent Michalski wrote in message <36432CDE.D0A486B1@technologist.com>...
>Larry Rosler posted a response to this thread. I am responding to it
>_before_ it got to the group because I have it up on my e-mail and the
>code is in front of me.
>
>He stated:
>
>Is it __that__simple really? Isn't there a problem here with barewords
>that '-w' would complain about?
>
>I am testing on an NT box, but just for proof that __My__ example works
>on __my__ system, here is my code:
>
>#!/usr/bin/perl -w
>
> use CGI qw /:standard/;
> $email = param(email);
> $msg = param(message);
> $subj = param(subject);
>
>print header;
>
>print "<PRE>";
>print "E-mail: $email\n";
>print "Msg: $msg\n";
>print "Subj: $subj\n";
>
>#### END OF CODE
>
>And here is the output I get:
>
>E-mail: e-mail here
>Msg: this is the message
>Subj: and I am the subject
>
>I know that the output, etc. is not pretty, I was just checking to make
>sure it worked...
>
>Sooooo, since it seems to work without any errors or warnings, I can
>safely say that my original post was correct __on NT systems__.
>
>Anynone have a unix system to test this on? I can't test it on UNIX
>until I get home...
>
Errors under Windows 95 Perl 5.0004_02, the latest version I have until I
return home:
Unquoted string "email" may clash with future reserved word at C:\EDIT7.PL
line 4.
Unquoted string "message" may clash with future reserved word at C:\EDIT7.PL
line 5.
Unquoted string "subject" may clash with future reserved word at C:\EDIT7.PL
line 6.
AmD
------------------------------
Date: Fri, 06 Nov 1998 12:31:51 -0600
From: Dan Baker <dtbaker-@busprod.com>
Subject: Re: readdir bug in win95 perl 5.00402? - test script
Message-Id: <36434096.A76CB336@busprod.com>
sorry, I should have pasted the script inline so you wouldn't have to
download.... here it is:
#! /usr/bin/perl -w
# hardcode for test
local $TagType = 'DirList2Option';
local $MatchPattern = '.*';
print "Content-type: text/plain\n\n";
# call sub just to emulate real conditions
&DoListing;
# end of Main program -----------
# -------------------------------
sub DoListing {
# hardcode for test
my $DirPath = '.'; # init to current working dir
# $DirPath = "../PatientFolders"; # set DirPath to a test dir
# >>>>>>> this assignment causes the problem <<<<<<<<<<<<<<<<<<<<<<<
# seems that if $DirPath is set to anything other than current
# working dir where perl script was started, then
# while readdir() does get a listing of the dir, the listing type
# test fails and thinks that all listing are files even when they
# are directories.
# following code is extracted from larger program.....
# open a filehandle
if ( not (opendir(DIR, $DirPath))) {
my @mytime = localtime(time); # grab time values in array
die "died in $0 at $mytime[2]:$mytime[1]:$mytime[0]\n".
"because we could not open $DirPath\n " ;
}
my $Listing = "";
# look at each listing
foreach $Listing ( sort(readdir(DIR)) ) {
if ( $Listing eq '.' ) {next} # throw away the first listing
if ( $Listing eq '..' ) {
print "<OPTION>../ back one level\n" ;
next;
}
# decide if we should skip listing
if (( $TagType eq 'DirList2Option' ) and not ( -d $Listing )) {
# >>>>>>>>>>>> this is the test that fails <<<<<<<<<<<
print "decided $Listing is NOT a directory\n"; # added for debug
next;}
if (( $TagType eq 'FileList2Option' ) and ( -d $Listing )) {next}
if ( not ( $Listing =~ m/$MatchPattern/ )) {next}
# print code for HTML OPTION string
print "<OPTION>$Listing\n";
} # done with *List2Option TYPEs
closedir(DIR);
1;
}
__END__
Dan Baker wrote:
>
> directory test like ( -d $Listing ) always false if opendir() not in '.'
> ????
> (the executive summary...)
>
> I have been having a nightmare with readdir for the last couple of
> days... The problem is that I'm using readdir to grab a listing of a
> directory, and the attributes of the items doesn't seem to be getting
> read correctly if I opendir() anywhere other than the current working
> dir where the test script is being executed.
> The readdir() will open and get a listing, but a directory test like (
> -d $Listing ) will fail because it always returns false. If I hardcode
> readdir() to use the current '.', then the test goes well....
>
> I am running the standard version of perl, downloaded from CPAN
> perl5_00402-bindist04-bc.zip on win95
>
> I've attached test code for your examination. please.... any ideas or
> errors in the code I've overlooked? it assumes that there are some test
> files and dirs set up to list.
>
> --
> Thanx, Dan
>
> # If you would like to reply-to directly, remove the - from my username
> * no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B) *
>
> ------------------------------------------------------------------------
>
> Name: TestD.pl
> TestD.pl Type: Perl Program (application/x-perl)
> Encoding: 7bit
--
Thanx, Dan
# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B) *
------------------------------
Date: Fri, 06 Nov 1998 12:25:13 -0600
From: Dan Baker <dtbaker@-busprod.com>
Subject: readdir bug in win95 perl 5.00402?
Message-Id: <36433F09.779ED972@-busprod.com>
This is a multi-part message in MIME format.
--------------68D170FD86F0138107D7CA35
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
directory test like ( -d $Listing ) always false if opendir() not in '.'
????
(the executive summary...)
I have been having a nightmare with readdir for the last couple of
days... The problem is that I'm using readdir to grab a listing of a
directory, and the attributes of the items doesn't seem to be getting
read correctly if I opendir() anywhere other than the current working
dir where the test script is being executed.
The readdir() will open and get a listing, but a directory test like (
-d $Listing ) will fail because it always returns false. If I hardcode
readdir() to use the current '.', then the test goes well....
I am running the standard version of perl, downloaded from CPAN
perl5_00402-bindist04-bc.zip on win95
I've attached test code for your examination. please.... any ideas or
errors in the code I've overlooked? it assumes that there are some test
files and dirs set up to list.
--
Thanx, Dan
# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B) *
--------------68D170FD86F0138107D7CA35
Content-Type: application/x-perl; name="TestD.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="TestD.pl"
#! /usr/bin/perl -w
# hardcode for test
local $TagType = 'DirList2Option';
local $MatchPattern = '.*';
print "Content-type: text/plain\n\n";
# call sub just to emulate real conditions
&DoListing;
# end of Main program -----------
# -------------------------------
sub DoListing {
# hardcode for test
my $DirPath = '.'; # init to current working dir
# $DirPath = "../PatientFolders"; # set DirPath to a test dir
# >>>>>>> this assignment causes the problem <<<<<<<<<<<<<<<<<<<<<<<
# seems that if $DirPath is set to anything other than current
# working dir where perl script was started, then
# while readdir() does get a listing of the dir, the listing type
# test fails and thinks that all listing are files even when they
# are directories.
# following code is extracted from larger program.....
# open a filehandle
if ( not (opendir(DIR, $DirPath))) {
my @mytime = localtime(time); # grab time values in array
die "died in $0 at $mytime[2]:$mytime[1]:$mytime[0]\n".
"because we could not open $DirPath\n " ;
}
my $Listing = "";
# look at each listing
foreach $Listing ( sort(readdir(DIR)) ) {
if ( $Listing eq '.' ) {next} # throw away the first listing
if ( $Listing eq '..' ) {
print "<OPTION>../ back one level\n" ;
next;
}
# decide if we should skip listing
if (( $TagType eq 'DirList2Option' ) and not ( -d $Listing )) {
print "decided $Listing is NOT a directory\n"; # added for debug
next;}
if (( $TagType eq 'FileList2Option' ) and ( -d $Listing )) {next}
if ( not ( $Listing =~ m/$MatchPattern/ )) {next}
# print code for HTML OPTION string
print "<OPTION>$Listing\n";
} # done with *List2Option TYPEs
closedir(DIR);
1;
}
__END__
--------------68D170FD86F0138107D7CA35--
------------------------------
Date: Fri, 06 Nov 1998 19:04:57 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: REMOTE_USER
Message-Id: <36435714.CAF41E03@netgenics.knowspaaaamm.com>
use this. you do have perl installed, don't you? heh.
--
#!/usr/bin/perl
print "Content-type: text/html\n\n";
while (($key, $val) = each %ENV) {
print "$key = $val<BR>\n";
}
Jay Moore wrote:
> While this is not really a Unix security question, I don't know where
> else to post.
>
> If I enable SSL for client authentication on my web server, does the CGI
>
> environment variable REMOTE_USER still get set?
>
> Thanx,
> jay
>
> ------------------------------------------------------------------------
>
> Jay Moore <moorejay@netscape.net>
> Senior Unix Systems Engineer
> Domain Techonolgies
>
> Jay Moore
> Senior Unix Systems Engineer <moorejay@netscape.net>
> Domain Techonolgies HTML Mail
> 1901 N. Ft Myer Drive Work: 703.351.5870 x252
> Arlington
> VA
> Additional Information:
> Last Name Moore
> First Name Jay
> Version 2.1
------------------------------
Date: Fri, 6 Nov 1998 18:12:07 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Script calling Remote Script
Message-Id: <siaf24pu6g.fsf@cre.canon.co.uk>
Matt Turner <matt@godzilla.tamu.edu> wrote:
> Here is what I am trying...I want to be able to send data to a CGI
> script on my webserver/firewall and have that CGI script send the same
> data to another CGI script running on a webserver behind the firewall.
> I don't need a response or anything from the scripts, I just need to
> data to get all the way to the internal machine.
The CGI::Base module has a `pass_thru' operation that passes an HTTP
request on to another server:
$q = new CGI::Base;
$q->pass_thru($host, $port);
Of course, if you're going to do this haphazardly, then you gain little
in the way of extra security from having the second webserver inside
your firewall...
--
Gareth Rees
------------------------------
Date: Fri, 6 Nov 1998 19:32:46 +0100
From: "Casema" <ours@casema.net>
Subject: Re: Sendmail-code needed
Message-Id: <71vfef$lrd$1@sun4000.casema.net>
I am trying to learn perl. I need not to hire a programmer though people
pointing me in the right direction.
Thanks anyway.
I downloaded Blat, which would enable me to do command line
mailing....simply not possible on windows nt. This would be a help!
I am trying to find ports for nt. Blat would be one for command line
mailing. Allready got a chmod for nt.
Michel
Brent Michalski wrote in message <36432B4A.74C53AC2@technologist.com>...
------------------------------
Date: Fri, 06 Nov 1998 19:33:05 GMT
From: bill_mcintyre@my-dejanews.com
Subject: Shared CGI.pm from various directories
Message-Id: <71vith$j0m$1@nnrp1.dejanews.com>
I know this is probably simple but I have a brain lock on it.
i have quite a few scripts that use the CGI.pm module. To increase security
and orderliness I have created subdirectories in CGI-BIN to store different
types of scripts. My problem is that I can't figure out how to call CGI.pm
from different locations. When I "USE CGI" CGI.pm seems to only work in the
same directory as the script that is calling it. How can I have just one copy
of CGI.pm and call it from differnet scripts in differnet directories.
TIA.
Bill McIntyre (bill_mcintyre@hotmail.com)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 6 Nov 1998 09:10:14 -0800
From: swingkid@usa.net (Mark Tagawa)
Subject: Re: Tk on NT
Message-Id: <MPG.10accd53e55a79ac989689@news.newsguy.com>
Hmm, I didn't know that. I guess it just shows that it is true that
"there's more than one way to do it with perl."
In article <36431E82.A9AFA994@orator.usma.edu>, erich@orator.usma.edu
says...
> Or just use Gurusamy Sarathy's NT port of perl. No need to download TK because it's part
> of this build.
>
Cheers,
Mark
------------------------------
Date: 6 Nov 1998 19:21:14 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: Re: what does split do on empty fields?
Message-Id: <71vi7a$6u4$1@aurwww.aur.alcatel.com>
On 05 Nov 1998 18:38:25 -0700, Eric The Read <emschwar@mail.uccs.edu> wrote:
> The problem is, not all lines have fields 21 and 22 defined --
> they just have:
>
> "[20 fields]|||[some more fields]" or
> "[20 fields]|1998/11/05||[some more fields]" or
> "[20 fields]||1998/11/05|[some more fields]"
>
> in them. That's fine-- if there's nothing there, I don't need to convert
> anything, so I want to skip that field.
:
> My question is, what does "split" do if the value between the split
> characters is empty? I've tried testing
>
> if(defined $tmp[21])
> if($tmp[21] ne '')
>
> to find out if there's anything in that field, but neither of those seem
> to work.
Be careful that you're counting fields correctly. Remember that the first
field is field 0, not field 1. Where you're checking $tmp[21], it looks
to me like you want to be checking $tmp[20]. That aside, I'm not sure why
your code does what it does. To wit:
#!/usr/bin/perl -w
use strict;
my $idx = 0;
for my $val (split /\|/, 'foo|bar|1||2|||4|5|baz|hello|99|world||')
{
print $idx++, "\t";
if (!defined $val)
{
print 'UNDEF';
}
elsif ($val eq '')
{
print 'EMPTY';
}
else
{
print '[', $val, ']';
}
print "\n";
}
gives me:
0 [foo]
1 [bar]
2 [1]
3 EMPTY
4 [2]
5 EMPTY
6 EMPTY
7 [4]
8 [5]
9 [baz]
10 [hello]
11 [99]
12 [world]
under 5.004_04 (sun4-solaris).
--
John Klassa / Alcatel / Raleigh, NC, USA / $perl_monger{Raleigh}[0] / <><
------------------------------
Date: 06 Nov 1998 14:20:11 +1030
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <r8n265iioc.fsf@asc.sps.mot.com>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
> Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>
> [executing perl when #! doesn't work]
You mis-paraphrase me!
This was not the question. The question was not about the presence or
absense of #! processing, it was about avoiding specifying the path to
perl at all, and instead using the perl on the PATH. At least, that
is the question _I_ was answering :-)
> > (By The Way, how do I get this question, answer & explanation into the FAQ?)
>
> Note that this question is covered in perlrun, with various solutions
> depending on the exact situation.
In my version at least, this appears to be untrue.
(2/Aug/98 Last change: perl 5.005, patch 02 16)
It neither tells me how to avoid specifying the path to perl, nor how
such a trick works (for example: how the script ends up being
processed by sh, no matter what shell you are using, is something that
escaped me for ages!).
Every solution perlrun offers contains an explicit path to perl.
How do I suggest that this solution be incorporated in perlrun?
Thanks,
Martin.
------------------------------
Date: Fri, 06 Nov 1998 19:19:43 GMT
From: matt@ohionet.org
Subject: Re: windows nt user32.dll initialization and perl
Message-Id: <71vi4f$ibh$1@nnrp1.dejanews.com>
Can anyone confirm the below suggestion ??
-Matt
> Our testing shows that the Microsoft suggestion is wrong. The
> Q article describes changing "SharedSection=1024,3072 " to
> "SharedSection=1025,512,3072 ". What does work is changing
> it to "SharedSection=1024,512 ".
> ) initialization of the User32.dll has failed, this process
> [...]
> ) change HKEY_LOCAL_MACHINE\SYSTEM\
> ) CURRENTCONTROLSET\SESSIONMANAGER\
> ) SUBSYSTEMS\WINDOWS adding 512 where
> ) suggested by microsoft to limit the space each
> ) session grabs, but this makes no difference, (even when
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4167
**************************************