[10259] in Perl-Users-Digest
Perl-Users Digest, Issue: 3852 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 17:07:55 1998
Date: Tue, 29 Sep 98 14:00:24 -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 Tue, 29 Sep 1998 Volume: 8 Number: 3852
Today's topics:
[Win32] File/Directory Date Problem. <Scott.Boss@Bridge.BellSouth.Com>
[Win32] Net::Ping problems. <Scott.Boss@Bridge.BellSouth.Com>
Re: ActivePerl incompatibility? (network,socket) <philipNOSPAM@hrsites.com>
Re: Alternate colors in tables with perl command? (Charlie Watts)
Re: Alternate colors in tables with perl command? <ajohnson@gpu.srv.ualberta.ca>
Re: CGI.pm - forms within tables - How to? (Matt Knecht)
Re: CGI.pm - forms within tables - How to? (Gene Johannsen)
Forking a daemon, passing parameters between the parent <apollock@bit.net.au>
Re: How do I capture a Broken Pipe Error? <ran@sgi.com>
Re: How do I capture a Broken Pipe Error? <uri@camel.fastserv.com>
How do I convert a number to a string? <stevehar@newbridge.com>
Re: How do I convert a number to a string? (Larry Rosler)
Re: How do I sort a multidimensional array???? <smaring@gte-es.com>
Re: Many processes communication - How To? <sergio@mail.pt>
Re: Need help with interpolation of a scalar !! ? (David A. Black)
Re: Need help with interpolation of a scalar !! ? <ran@sgi.com>
Re: Need help with interpolation of a scalar !! ? <uri@camel.fastserv.com>
Re: Need method to round real number to two decimal pla <murrayb@vansel.alcatel.com>
open2, cmd + args ??? (Stephen Elias)
Perl Installation Problem on NT Server (James F)
Re: perl win32 and microsoft sql <tbornhol@nospamprioritytech.com>
Re: regex problem (Patrick Timmins)
Re: regex problem (Abigail)
Re: regex problem pneuma_66@yahoo.com
Re: require statements cause netscape server errors rockwell@shr.dec.com
Re: restricting script execution? <work@nospam.idea.co.uk>
Re: restricting script execution? <eashton@bbnplanet.com>
Re: SRC: encrypt your Perl scripts! :-) jesten@wdynamic.com
Uploading file to browser <designer@sginet.com>
Re: weird mod_perl problem, probably not perl related (Ryan McGuigan)
Re: Will this FORM process the information slow?? (brian d foy)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Sep 1998 10:51:39 -0400
From: Scott Boss <Scott.Boss@Bridge.BellSouth.Com>
Subject: [Win32] File/Directory Date Problem.
Message-Id: <3610F3FB.112D6779@Bridge.BellSouth.Com>
Hello All,
I am trying to change the date of a directory under Windows 95 and I am
unable to do so. I follow the directions/examples out of {"Camel Book",
Advanced Camel Book - Bear?", "Perl Cookbook"}. I can not modify the
directory's time/date stamp. What am I doing wrong? Please give me
some advice...
Thanks
Scott Boss
email: Scott.Boss@Bridge.BellSouth.Com
------------------------------
Date: Tue, 29 Sep 1998 10:42:16 -0400
From: Scott Boss <Scott.Boss@Bridge.BellSouth.Com>
Subject: [Win32] Net::Ping problems.
Message-Id: <3610F1C8.AA09307B@Bridge.BellSouth.Com>
Hello All,
I am new to the Win32 enviroment (for programming in Perl) and I am
trying to run a small script that will ping an IP address of a UNIX
machine. Whenver I write a program that uses Net::Ping, and follow the
examples I either get "it is up" or "it is down" and the response is
depending on how I write the script and does not matter if the server is
up or down. On my first attempt the script always said the server was
up even with the server was down. From my same machine (Windows95) I
can use either Chamelon's ping or 95's ping and get the proper resonse
from the UNIX host. The perl program is haiving problems. Can anyone
give me any hints? Suggestion? Point in the right direction?
Thanks in Advance
Scott Boss
email: Scott.Boss@Bridge.BellSouth.Com
------------------------------
Date: Tue, 29 Sep 1998 14:34:11 -0500
From: Philip Parker <philipNOSPAM@hrsites.com>
Subject: Re: ActivePerl incompatibility? (network,socket)
Message-Id: <36113633.925F3541@hrsites.com>
Hmmm. Feelin a little silly now. I installed the services and it worked. THANKS.
Philip Parker
Brian Jepson wrote:
> On Tue, 29 Sep 1998 10:41:24 -0500, Philip Parker <philipNOSPAM@hrsites.com>
> wrote:
> >I've encountered a problem while trying to learn network programming
> >with Perl. I am using ActivePerl 5.005_02 build 502 on an NT4wks box
> >with SP3. The code below was taken directly from the blue llama 2nd ed.
> >(p246) but I've tried it on two machines (same Perl, OS, etc) and keep
> >getting the error message:
> >
> >IO::Socket::INET: Unknown error at C:\Work\ipctest.pl line 4
> >cannot connect to daytime port at localhost at C:\Work\ipctest.pl line
> >4.
> >
> [...]
>
> Is there a service running that listens to this port? Try telnetting to
> the port with:
>
> telnet localhost 13
>
> I think that daytime can be installed on your machine by going
> to the control panel, choosing Network->Services->Add and install "Simple
> TCP/IP Services". This is an optional component, so it might not be
> installed on your workstation. If it is, and if you can telnet to the
> port and get the time, then this might indicate a problem.
>
> Here's some sample code that works for me (ActiveState 502, NT Server 4.0
> SP3):
>
> use IO::Socket;
> $s = new IO::Socket::INET( PeerAddr => 'gelvis',
> PeerPort => 'daytime(13)');
> print $s->getline; # prints the time
>
> gelvis is a host on my network running GNU/Linux on a SPARCStation.
>
> --
> Brian Jepson * (bjepson@ids.net) * http://users.ids.net/~bjepson
> Choosy mothers choose to chew Chew-Z
------------------------------
Date: 29 Sep 1998 19:34:43 GMT
From: cewatts@animas.frontier.net (Charlie Watts)
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <slrn712dg9.o8d.cewatts@animas.frontier.net>
On 29 Sep 1998 16:32:20 GMT, Abigail <abigail@fnx.com> wrote:
>Daniel Pray (daniel@intecomp.com) wrote on MDCCCLV September MCMXCIII in
><URL:news:daniel-2809982259380001@usr10-dialup43.mix1.sacramento.cw.net>:
>++ I've seen some professional web site that have a perl script list a
>++ database request. The table is alternated rows of color. Does anyone know
>++ how to do this?
>
>I would use crayons.
Wow, Abigail, that was useful. :)
[ The big thick ones, or a big box of brand-new sharp ones? ]
As far as the serious answers go: There's obviously more than 3 ways to skin
a cat.
--
Charlie Watts Quidquid latine dictum sit, altum viditur.
cewatts@frontier.net (Whatever is said in Latin sounds profound.)
------------------------------
Date: Tue, 29 Sep 1998 15:24:39 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <36114207.13E0AFB0@gpu.srv.ualberta.ca>
Abigail wrote:
! Daniel Pray (daniel@intecomp.com) wrote on MDCCCLV September MCMXCIII in
! <URL:news:daniel-2809982259380001@usr10-dialup43.mix1.sacramento.cw.net>:
! ++ I've seen some professional web site that have a perl script list a
! ++ database request. The table is alternated rows of color. Does anyone know
! ++ how to do this?
!
! I would use crayons.
hmm:
use Crayons;
nope, maybe its a pragma:
use crayons;
nope...
Perhaps you've a custom Crayola interface that works with Perl?
Please let us know...
I've got one named Thomas, but it doesn't interface with Perl yet,
and while it is tireless (relentless even), the output is often
whimsical and unpredictable ... which, of course, would be working as
documented, if it came with documentation, but they never do :-0
regards
andrew
------------------------------
Date: Tue, 29 Sep 1998 19:04:24 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <YaaQ1.1055$7Q6.7046164@news2.voicenet.com>
Steven D Jones <Steve_D_Jones@hp.com> wrote:
>
>What I'm looking for is specific syntax examples. I've used CGI.pm to create
>both tables and forms, but not both together. I can't figure out the syntax
>to put the different radio buttons from a common radio group into different
>cells of a table.
Using the sub I posted earlier you could say:
$column =
[
[ 'Buttons', ],
[
$cgi->radio_group
(
'-name' => 'colors',
'-values' => [ qw/Red Green Blue/ ],
'-linebreak'=> 'true',
'-default' => 'Red'
);
]
];
print array_ref2table($column);
To get each button in a different cell. I considered this a bug when I
wrote it. It may be useful for you.
Prefixing the call to radio_group with 'scalar' will prevent this from
happening.
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: 29 Sep 1998 19:20:47 GMT
From: gej@spamalot.mfg.sgi.com (Gene Johannsen)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <6urbuf$rrj$1@murrow.corp.sgi.com>
Steve_D_Jones@hp.com (Steven D Jones) writes:
| I would like to create a form which is formated by placing the input fields
| inside of a table. Here's an html example:
|
| <HTML><BODY>
| <TABLE BORDER=1>
| <FORM>
|
| <TR>
| <TD><INPUT TYPE="radio" NAME="test" VALUE="Hello">Hello</TD>
| <TD><INPUT TYPE="radio" NAME="test" VALUE="Goodbye">Goodbye</TD>
| </TR>
|
| </FORM>
| </TABLE>
| </HTML></BODY>
|
| How would I do this using CGI.pm?
You would obviously start by reading the CGI.pm documentation.
It is very well written and contains sample code. Read it
online at: http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
gene
|
| Thanks for your help.
|
| Steve Jones
|
| Steve_D_Jones@hp.com
| 970-898-7805
------------------------------
Date: Tue, 22 Sep 1998 09:48:04 +1000
From: "Andrew Pollock" <apollock@bit.net.au>
Subject: Forking a daemon, passing parameters between the parent and the child
Message-Id: <6u6oji$1vc$1@hermes.bit.net.au>
Hi,
What I'm trying to accomplish is this:
I have a CGI script (in Perl) that accepts a request via a form.
This CGI script opens a pipe to another Perl script, and passes a number of
parameters to it. This script that the CGI script has opened a pipe to then
forks, and goes about it's business, and the parent CGI script then
terminates.
I'm having problems forking without getting zombies, and I'm having problems
in the second Perl script, passing the parameters received by the parent on
STDIN to the child that it forks.
Is it possible to do what I'm trying to do, or do the parent and child not
share the same namespace?
I'm forking using the example code in the Camel book.
Any help would be appreciated. Please reply to me via email as well as to
this group as our news server is a little temperamental at the moment.
Thanks in advance.
Andrew
------------------------------
Date: Tue, 29 Sep 1998 13:13:19 -0700
From: Ramesh Nagarajan <ran@sgi.com>
Subject: Re: How do I capture a Broken Pipe Error?
Message-Id: <36113F5F.F2F1E484@sgi.com>
Daniel Pray wrote:
> How do I capture a Broken Pipe Error and use it to do an action using the
> code provided?
>
> my $name = "filexxxxx";
> open(FILE, $name); # Here I want to run a Sub "&whatever" if the file
> doesn't get downloaded completely.
> print "Content-Type: application/x-stuffit\n";
> print "Location: $name\n\n";
> close FILE;
>
> Thanks,
>
> Daniel
Hi,
You can use this syntax
open(FILE,$name) || die "Broken Pipe\n";
Thanks
Ramesh
------------------------------
Date: 29 Sep 1998 16:57:23 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: How do I capture a Broken Pipe Error?
Message-Id: <sarbtnyvdqk.fsf@camel.fastserv.com>
>>>>> "RN" == Ramesh Nagarajan <ran@sgi.com> writes:
ramesh,
we appreciate your helping others but this is your second incorrect
posting in a row. please study up your perl more before you answer
queries in this group.
RN> Daniel Pray wrote:
>> How do I capture a Broken Pipe Error and use it to do an action using the
>> code provided?
>>
>> my $name = "filexxxxx";
>> open(FILE, $name); # Here I want to run a Sub "&whatever" if the file
>> doesn't get downloaded completely.
>> print "Content-Type: application/x-stuffit\n";
>> print "Location: $name\n\n";
>> close FILE;
what are you trying to do here? you never do any I/O on FILE. so what
file is being downloaded? and where is the pipe? the one connected from
the browser? if this is CGI then the pipe is connected to the server.
you open $name for reading. did you mean to write the file that was
downloaded from the client? then you should open it for writing like
this (untested):
use CGI::Carp ;
open(FILE, ">$name" ) || croak( "can't open $name $! ) ;
in general this is very unclear code and your description doesn't
clarify it at all.
RN> open(FILE,$name) || die "Broken Pipe\n";
if $name is not a pipe, then the error message is irrelevent. and you
don't print $! which will tell you why it failed.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 29 Sep 1998 14:48:08 -0400
From: Steve Harrison <stevehar@newbridge.com>
Subject: How do I convert a number to a string?
Message-Id: <36112B68.C5EBA3D3@newbridge.com>
I'm reading a line from a file and the line is a number such as
1111000011110001111
I want to find out the length of this number without Perl converting
this number to a floating
pointing format number.
I expect the length to be 19 characters in this case.
The below program seems to work as long as the number presented has 15
characters
or less.
How can I get this program to work without having to use $number =
"1111000011110001111"; ?
The line read from the file does not have the number surrounded by the
quotations.
Thank you for your help,
Steven
email: stevehar@newbridge.com
------------------------
#!/usr/local/bin/perl
$number = 1111000011110001111;
$length = length($number);
print "Number = $number\n";
print "Length = $length\n";
-------------------------
------------------------------
Date: Tue, 29 Sep 1998 12:12:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I convert a number to a string?
Message-Id: <MPG.107ad1004464a9679897cc@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <36112B68.C5EBA3D3@newbridge.com> on Tue, 29 Sep 1998 14:48:08
-0400, Steve Harrison <stevehar@newbridge.com> says...
> I'm reading a line from a file and the line is a number such as
> 1111000011110001111
>
> I want to find out the length of this number without Perl converting
> this number to a floating pointing format number.
>
> I expect the length to be 19 characters in this case.
> The below program seems to work as long as the number presented has 15
> characters or less.
>
> How can I get this program to work without having to use $number =
> "1111000011110001111"; ?
> The line read from the file does not have the number surrounded by the
> quotations.
A line read from a file is a string, and remains a string until you use
it as a number. The length function gives the length of a string, not of
a number, so it works fine on any string, number or not.
You showed code that worked, but not code that didn't work. Try this:
#!/usr/local/bin/perl -w
while (<DATA>) {
chomp;
print length, "\n";
}
__END__
1111000011110001111
This prints 19, as expected.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 29 Sep 1998 18:55:54 +0000
From: Steve Maring <smaring@gte-es.com>
Subject: Re: How do I sort a multidimensional array????
Message-Id: <6urao3$foa$1@news-1.news.gte.net>
I've tried:
@array = sort($array[$a][0] <=> $array[&b][0]);
and
sort { $a->[0] <=> $b->[0] } @array;
neither worked.
Steve Maring wrote:
> I have a two dimensional array that I would like to sort based on the x
> element of [x][y]
>
> I tried this;
>
> @array = ( [3,2,1], [1,3,4], [6,7,8] );
> print("before sort\n");
> for ($i=0;$i<=$#array;$i++) {
> print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
> }
>
> @array = sort($array[$a][0] cmp $array[$b][0]); <--- does not
> like this
>
> print("after sort\n");
> for ($i=0;$i<=$#array;$i++) {
> print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
> }
>
> Can someone offer a suggestion?
>
> Thanks.
>
> -Steve Maring
> Tampa, FL
>
------------------------------
Date: Tue, 29 Sep 1998 17:42:58 -0300
From: Sergio Bernardo <sergio@mail.pt>
To: Kjetil Skotheim <kjetil.skotheim@usit.uio.no>
Subject: Re: Many processes communication - How To?
Message-Id: <36114652.85C78195@mail.pt>
> See "Unix-Domain TCP Clients and Servers" in that same perlipc
> man page. Works fine for me.
Thank you all that answered me!
After some problems with a missing autoflush,
my problem is solved using a socket!
Sergio Bernardo
sergio@mail.pt
------------------------------
Date: Tue, 29 Sep 1998 16:27:59 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <6urfsf$s1i$1@earth.superlink.net>
Ramesh Nagarajan <ran@sgi.com> writes:
>--------------D8978D26E4E6CA13A8139498
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>Steve maZe wrote:
>> Here is the code and the output:
>>
>> knowing that
>> $current ends up being "something".html
>> adn $logfile is the path to a log file (Duh :)
>>
>> foreach $temp (@htmllist)
>> {
>> $current = `basename $temp`;
>> print "current is $current<BR>\n";
>> print "logfile is $logfile<BR>\n";
>> $pagehit = `grep $current $logfile | wc -l`;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Problem is here (I think)
>> print <<EOF1;
>> Number of Hits for $current is $pagehit<BR><BR>
>> EOF1
>> $hits = 0;
>> }
> Hi,
> Instead of $pagehit = `grep $current $logfile| wc -l`;
> you can use the grep function in perl
> $pagehit = grep($current,$logfile); #should give the correct result
Perl's grep() doesn't take a filename as an argument!
David Black
dblack@saturn.superlink.net
------------------------------
Date: Tue, 29 Sep 1998 13:07:02 -0700
From: Ramesh Nagarajan <ran@sgi.com>
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <36113DE6.42B997F9@sgi.com>
--------------D8978D26E4E6CA13A8139498
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Steve maZe wrote:
> Here is the code and the output:
>
> knowing that
> $current ends up being "something".html
> adn $logfile is the path to a log file (Duh :)
>
> foreach $temp (@htmllist)
> {
> $current = `basename $temp`;
> print "current is $current<BR>\n";
> print "logfile is $logfile<BR>\n";
> $pagehit = `grep $current $logfile | wc -l`;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Problem is here (I think)
> print <<EOF1;
> Number of Hits for $current is $pagehit<BR><BR>
> EOF1
> $hits = 0;
> }
>
> The problem is that $pagehit ends up as 0. and if I enclose $current
> in '' in gives me a fixed number (2390) ?? .. don't get it ... help
> anyone ??
> I am failry new to perl and I did look through the camel book but to
> no avail !!
>
> HELP
>
> THX
> steve
Hi,
Instead of $pagehit = `grep $current $logfile| wc -l`;
you can use the grep function in perl
$pagehit = grep($current,$logfile); #should give the correct result
Thx
Ramesh
--------------D8978D26E4E6CA13A8139498
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Steve maZe wrote:
<BLOCKQUOTE TYPE=CITE> Here is the code and the output:
<P>knowing that
<BR>$current ends up being "something".html
<BR>adn $logfile is the path to a log file (Duh :)
<P>foreach $temp (@htmllist)
<BR> {
<BR> $current = `basename $temp`;
<BR> print "current is $current<BR>\n";
<BR> print "logfile is $logfile<BR>\n";
<BR> $pagehit = `grep $current
$logfile | wc -l`;
<BR>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Problem is here (I think)
<BR> print <<EOF1;
<BR>
Number of Hits for $current is $pagehit<BR><BR>
<BR>EOF1
<BR>$hits = 0;
<BR> }
<P> The problem is that $pagehit ends up as 0. and if I enclose $current
<BR>in '' in gives me a fixed number (2390) ?? .. don't get it ... help
<BR>anyone ??
<BR> I am failry new to perl and I did look through the camel book
but to
<BR>no avail !!
<P> HELP
<P> THX
<BR> steve</BLOCKQUOTE>
<PRE> Hi,</PRE>
<PRE> Instead of $pagehit = `grep $current $logfile| wc -l`;</PRE>
<PRE> you can use the grep function in perl</PRE>
<PRE> $pagehit = grep($current,$logfile); #should give the correct result</PRE>
<PRE></PRE>
<PRE> Thx</PRE>
<PRE> Ramesh</PRE>
<PRE></PRE>
<PRE> </PRE>
</HTML>
--------------D8978D26E4E6CA13A8139498--
------------------------------
Date: 29 Sep 1998 16:48:49 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <sard88eve4u.fsf@camel.fastserv.com>
>>>>> "RN" == Ramesh Nagarajan <ran@sgi.com> writes:
i skipped this the first time but i had to fix this incorrect reply. so
i will also try to help out the original poster.
RN> Steve maZe wrote:
>> foreach $temp (@htmllist) { $current = `basename $temp`; print
>> "current is $current<BR>\n"; print "logfile is $logfile<BR>\n";
use the Basename module or some other common method to get the filename
from a path. forking a process to do it is a big waste of cpu time.
also you can merge those 2 prints into one. use the << here file syntax
to manage long strings.
>> $pagehit = `grep $current $logfile | wc -l`;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Problem is here (I think)
>> print <<EOF1; Number of Hits for $current is $pagehit<BR><BR> EOF1
>> $hits = 0; }
what are you searching for? do you want the number of times the string
$current appears in the file $logfile? if you just want the count of
lines then the -c option to grep will give you that without the need to
call wc.
also it could be done inside perl which should be faster but will
require that you read in the file and do a match on it. if the file is
not too big then you can read it in as one big string and do one match
which can count the hits. or you can read it a line at a time and match
each line and count it.
>> The problem is that $pagehit ends up as 0. and if I enclose
>> $current in '' in gives me a fixed number (2390) ?? .. don't get it
>> ... help anyone ?? I am failry new to perl and I did look through
>> the camel book but to no avail !!
what is in $current and $logfile? have you verified they have good
values? is $current a legal search pattern for grep? if not then you
will get an error and you are not checking for that.
you should check that the `` command executed correctly by looking at
$? var.
RN> Instead of $pagehit = `grep $current $logfile| wc -l`;
RN> you can use the grep function in perl
RN> $pagehit = grep($current,$logfile); #should give the correct
this has nothing to do with the grep program. and it will always return
the value $logfile (if $current is true in the perlish way). please read
the perlfunc page on grep before you post such incorrect information.
and please don't post html to this group.
hth,
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 29 Sep 1998 11:59:25 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Need method to round real number to two decimal places
Message-Id: <uzpbiu4mq.fsf@vansel.alcatel.com>
rscaife@falcon.csc.calpoly.edu (Roy Kenneth Scaife) writes:
> Using printf is _not_ an option as
> the new value will then be used for further calculations.
sprintf and a trip to the manual are in order.
--
Brad Murray "The secret of joy in work is contained in one
Software Analyst word: excellence. To know how to do something well
Alcatel Canada is to enjoy it." Pearl S. Buck
------------------------------
Date: Tue, 29 Sep 1998 19:15:31 GMT
From: steven_elias@ml.com (Stephen Elias)
Subject: open2, cmd + args ???
Message-Id: <36113006.4536172@news.ml.com>
Hi,
I'm having problems using the open2 function and passing arguments
to the command I'm opening:
This works:
require 'open2.pl';
&open2(RDR,WTR,"bc");
print WTR "2+2\nquit\n";
while(<RDR>) {
print;
}
And This Works:
require 'open2.pl';
&open2(RDR,WTR,"bc", "data.txt");
print WTR "2+2\nquit\n";
while(<RDR>) {
print;
}
However, this doesn't work:
require 'open2.pl';
&open2(RDR,WTR,"bc data.txt");
print WTR "2+2\nquit\n";
while(<RDR>) {
print;
}
>perl mybc.pl
open2: IO::Pipe: Can't spawn-NOWAIT: No such file or directory at
mybc.pl line 2
The documentation says this:
SYNOPSIS
use IPC::Open2;
$pid = open2(\*RDR, \*WTR, 'some cmd and args');
# or
$pid = open2(\*RDR, \*WTR, 'some', 'cmd', 'and', 'args');
--------------------------------------------------------------------------------
DESCRIPTION
The open2() function spawns the given $cmd and connects $rdr for
reading and $wtr for writing. It's what you think should work when you
try
open(HANDLE, "|cmd args|");
The write filehandle will have autoflush turned on.
What am I do wrong ???
Thanks
------------------------------
Date: 29 Sep 1998 20:52:22 GMT
From: not@this.address (James F)
Subject: Perl Installation Problem on NT Server
Message-Id: <361139ca.313474903@netnews.worldnet.att.net>
I downloaded the latest version of ActiveStates Perl (build 502) and
when I try to load in onto my NT server (running N.T 4.0) I get an
error message box. The box title is "PackageForTheWeb error" and the
error in the box reads: "System error during decompression."
I have uploaded this file several and it appears to be good.
I have successfully loaded this version on an NT workstation and it
works fine.
Can anyone help?
Thanks in advance.
------------------------------
Date: 29 Sep 1998 15:18:00 -0500
From: "Tim Bornholtz" <tbornhol@nospamprioritytech.com>
Subject: Re: perl win32 and microsoft sql
Message-Id: <4fbQ1.5334$ue5.1103256@newscene.newscene.com>
Look in CPAN for Win32::ODBC
ananth wrote in message <907048477.14294@wren.supernews.com>...
>i would greatly appreciate if somebody could let me know how i could access
my microsoft sql database using perl.
>i have installed perl for win32 in my system.
>
>
> -**** Posted from Supernews, Discussions Start Here(tm) ****-
>http://www.supernews.com/ - Host to the World's Discussions & Usenet
------------------------------
Date: Tue, 29 Sep 1998 18:00:19 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: regex problem
Message-Id: <6ur77i$mba$1@nnrp1.dejanews.com>
In article <6uqtq7$arq$1@nnrp1.dejanews.com>,
cristiana@my-dejanews.com wrote:
> I was writing a perl script and i used the regex $value=~s/\s*$//g and when
> perl (5.00502) got to that line it gave me a core dump, but when i changed it
> to $value=~s/\s+$//g it worked fine. Does anyone know why the first regex
> died? cristiana
I can't see where it would be a problem. I couldn't make it fail
with various inputs when I tested it (5.004_02, though). It's just
removing any white space that might occur at the end of $value .
You *can* lose the 'g' modifier, though, as it is not necessary.
Is this a reproducable thing for you on 5.005_02? A bug?
Patrick Timmins
$monger{Omaha}[0]
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 29 Sep 1998 19:53:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regex problem
Message-Id: <6urdrf$hi$2@client3.news.psi.net>
Andrew Perrin (aperrin@mcmahon.qal.berkeley.edu) wrote on MDCCCLV
September MCMXCIII in <URL:news:36110692.708589D5@mcmahon.qal.berkeley.edu>:
++ Hmmm, I'm no expert, but wouldn't your first regex match all of any string
++ (i.e., it's 0 or more whitespace characters followed by the end of the string)?
++ In which case wouldn't $value always end up empty?
How many whitespace characters do you count in "FOO" ?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Tue, 29 Sep 1998 20:28:19 GMT
From: pneuma_66@yahoo.com
Subject: Re: regex problem
Message-Id: <6urft3$1rs$1@nnrp1.dejanews.com>
i am sorry, the regex $val=~s/\s*$//g only failed with 5.005_01 but it did not
fail in 5.005_02. i thought i remembered which version i was running, but i
guess i didn't. So i guess it was a bug, but only in 5.005_01
cristiana
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 18:47:53 GMT
From: rockwell@shr.dec.com
Subject: Re: require statements cause netscape server errors
Message-Id: <6ura0p$pjm$1@nnrp1.dejanews.com>
vasu,
INC did in fact have dot as one of the places to look, but windows had an idea
of what dot
meant (probably correct) than what I thought , which I discovered by doing a
$curdir=`cd`;
I added the path explicitly as you suggestted and now all is fine, thanks for
your help
SKotha wrote:
A correction:
In an earlier mail I said:
lib '/path/to/the/file';
It should be:
use lib '/path/to/the/file';
Vasu
NB: Please use my email address after deleting the word 'mail' from it
--------------------------------------------------------------------------
--------
"Always complete your actions." --Deng Ming-Dao
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 19:57:55 +0100
From: Kiril <work@nospam.idea.co.uk>
Subject: Re: restricting script execution?
Message-Id: <36112DB3.4E4510A7@nospam.idea.co.uk>
Elaine -HappyFunBall- Ashton wrote:
>
> Set the environment up such as
>
> $ENV{'PATH'} = '/usr/bin:/pkg/acct/sbin';
> $ENV{'IFS'} = $ENV{'IFS'} ne '' ? $ENV{'IFS'} : '';
> $< = $>;
I think I understand this, but not quite what I meant.
Follow that with
open EEK, ">/tmp/file" .......
which is one of the things that must be prohibited, so
chroot() it would be ...
> > what I am driving at is (I suppose) is a 'security' shell between an
> > eval'd script
> > and the functions it calls.
>
> Psst...I think someone did this already and comes with the source of
> Perl.
right :-(... would I be correct assuming that 'overloading' of the
standard Perl functions is definetly not an option, then...
> > can anyone tell me whether this is possible 'in principle', or should I
> > just forget
> > the whole idea and/or start reading the perl source ?
>
> Reading the source is fun :)
"To a sufficiently fuzzy definition of 'fun'." :-)
Oh well, might as well get on with it :-(
> e.
Kiril
------------------------------
Date: Tue, 29 Sep 1998 19:34:14 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: restricting script execution?
Message-Id: <361133C6.788288DD@bbnplanet.com>
Kiril wrote:
> I think I understand this, but not quite what I meant.
> Follow that with
> open EEK, ">/tmp/file" .......
> which is one of the things that must be prohibited, so
> chroot() it would be ...
Hrm. Let me ask this then. Why give them Perl if you want to take so
much away?
Perhaps write something that looks to a configuration file which lists
only the functions you are allowing and kills anything else. How do you
determine which are OK and which aren't? Anything can be a problem in
the right hands.
> right :-(... would I be correct assuming that 'overloading' of the
> standard Perl functions is definetly not an option, then...
Hack the source then :)
> > Reading the source is fun :)
>
> "To a sufficiently fuzzy definition of 'fun'." :-)
Well, I don't get out much. Besides, where are you going to find goodies
like this...?
* "...we will have peace, when you and all your works have
perished--and
* the works of your dark master to whom you would deliver us. You are
a
* liar, Saruman, and a corrupter of men's hearts." --Theoden
> Oh well, might as well get on with it :-(
Enjoy.
*Pssst* Please fix your word wrap.
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: Tue, 29 Sep 1998 20:15:38 GMT
From: jesten@wdynamic.com
Subject: Re: SRC: encrypt your Perl scripts! :-)
Message-Id: <6urf5b$10p$1@nnrp1.dejanews.com>
In article <6ur3mt$nct$1@info.uah.edu>,
Greg Bacon <gbacon@cs.uah.edu> wrote:
> You can also find this at
>
> <URL:http://www.cs.uah.edu/~gbacon/perl/encrypt>
>
> Enjoy!
>
> #! /usr/bin/perl -w
>
> # Copyright (c) 1998 Greg Bacon. All Rights Reserved.
> # This program is free software. You may distribute it or modify
> # it (perhaps both) under the terms of the Artistic License that
> # comes with the Perl Kit.
>
> use strict;
> use integer;
>
> foreach my $file (@ARGV) {
> unless (open FILE, $file) {
> warn "$0: failed open $file: $!\n";
> next;
> }
>
> my $key = int rand 256;
>
> my $out = <<EOTop;
> #! /usr/bin/perl
>
> my \$prog = '';
>
> {
> my \$key = $key;
> local \$/;
>
> \$prog = pack "c*",
> map { \$_ = \$_ ^ \$key }
> unpack "c*", <DATA>;
> }
>
> eval \$prog;
> __END__
> EOTop
>
> while (<FILE>) {
> $out .= pack "c*",
> map { $_ = $_ ^ $key }
> unpack "c*", $_;
> }
> close FILE;
>
> unless (open FILE, ">$file") {
> warn "$0: failed open >$file: $!\n";
> next;
> }
>
> print FILE $out;
> close FILE;;
> }
>
....note that the encryption fails on here documents...
print <<EOF;
becomes...
print <<E
Otherwise rather nifty....
Jim
--
Jim Esten, Lead Developer, WebDynamic/
Applications Lead, StarQuest Internet Services
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 13:17:00 -0600
From: Steve & Debby Caldwell <designer@sginet.com>
Subject: Uploading file to browser
Message-Id: <3611322B.867747E@sginet.com>
Help!!! I'm a Perl newbie and I have been working on this problem for a
week without much success. I have several files I want to be able to
upload to web users. They are set up as Adobe Acrobat files (PDF) and
the only way I have been able find to let people download them if by
using--print "Location: ..." Trouble is, if the user has the Acrobat
plug-in, Reader kicks in without really saving the file. There has to
be a way to get the file to the user either as a binary file, or without
triggering the plug-in.
I have been through every FAQ I can find, and run though all my
manuals. I even contacted Netscape and Microsoft (boy, was that a waste
of time). Rumor is, all the knowledge of the universe resides here in
this newsgroup. I hope you can help.
Keep the explanations simple; I'm not that bright.
Debby
------------------------------
Date: Tue, 29 Sep 1998 19:14:45 GMT
From: ryan@mail.ramresearch.com (Ryan McGuigan)
Subject: Re: weird mod_perl problem, probably not perl related
Message-Id: <FkaQ1.291$Fl6.5624877@news.abs.net>
This is the output from a simple test script, below.
-----------------------------------
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
foreach (keys %ENV) {
print "$_ = $ENV{$_}\n";
}
----------------------------------
just prints all env vars.
Notice PATH_INFO is set to // when it should be empty.
----------------------------------------------------------
SERVER_SOFTWARE = Apache/1.3.2 (Unix) mod_perl/1.15_01 mod_ssl/2.0.11
SSLeay/0.9.0b
DOCUMENT_ROOT = /www/htdocs/
GATEWAY_INTERFACE = CGI-Perl/1.1
REMOTE_ADDR = 205.161.111.215
SERVER_PROTOCOL = HTTP/1.0
REQUEST_METHOD = GET
QUERY_STRING =
HTTP_USER_AGENT = Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686; Nav)
PATH = /bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin
HTTP_CONNECTION = Keep-Alive
HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*
REMOTE_PORT = 6337
HTTP_ACCEPT_LANGUAGE = en
MOD_PERL = 1.15_01
SCRIPT_NAME = /mod_perl/test.pl
SCRIPT_FILENAME = /www/mod_perl/test.pl
HTTP_ACCEPT_ENCODING = gzip
HTTP_PRAGMA = no-cache
SERVER_NAME = www.cardweb.com
HTTP_ACCEPT_CHARSET = iso-8859-1,*,utf-8
PATH_INFO = //
REQUEST_URI = /mod_perl/test.pl
HTTP_COOKIE = EGSOFT_ID=205.161.111.52-757846400.29218475
SERVER_PORT = 80
HTTP_HOST = www.cardweb.com
PATH_TRANSLATED = /www/htdocs///
SERVER_ADMIN = webmaster@cardweb.com
----------------------------------------
here is some normal output, what it should say. Under normal CGI it
ALWAYS appears like the below, while under mod_perl it appears like the
below maybe 9 out of 10 times.
---------------------------------------
SERVER_SOFTWARE = Apache/1.3.2 (Unix) mod_perl/1.15_01 mod_ssl/2.0.11
SSLeay/0.9.0b
DOCUMENT_ROOT = /www/htdocs/
GATEWAY_INTERFACE = CGI-Perl/1.1
REMOTE_ADDR = 205.161.111.215
SERVER_PROTOCOL = HTTP/1.0
REQUEST_METHOD = GET
QUERY_STRING =
HTTP_USER_AGENT = Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686; Nav)
PATH = /bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin
HTTP_CONNECTION = Keep-Alive
HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*
REMOTE_PORT = 6772
HTTP_ACCEPT_LANGUAGE = en
MOD_PERL = 1.15_01
SCRIPT_NAME = /mod_perl/test.pl
SCRIPT_FILENAME = /www/mod_perl/test.pl
HTTP_ACCEPT_ENCODING = gzip
SERVER_NAME = www.cardweb.com
HTTP_PRAGMA = no-cache
REQUEST_URI = /mod_perl/test.pl
HTTP_ACCEPT_CHARSET = iso-8859-1,*,utf-8
HTTP_COOKIE = EGSOFT_ID=205.161.111.52-757846400.29218475
SERVER_PORT = 80
HTTP_HOST = www.cardweb.com
SERVER_ADMIN = webmaster@cardweb.com
--------------------------------------------
brian d foy (comdog@computerdog.com) wrote:
: In article <Kn5Q1.284$Fl6.5438317@news.abs.net>, ryan@mail.ramresearch.com (Ryan McGuigan) posted:
: >I have a script I'm trying to port to mod_perl, I just got it to work
: >without dying or killing anything, but there is still this weird problem.
: >Every once in a while, the PATH_INFO env var gets set to / or // for no
: >reason at all.
: well, it's unlikely that it gets set to anything for no reason at all.
: examine the situations in which that happens and find the correlation.
: other than that, it's difficult to happen you with so little information.
: --
: brian d foy <comdog@computerdog.com>
: CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
: Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
: Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>
------------------------------
Date: Tue, 29 Sep 1998 15:48:01 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Will this FORM process the information slow??
Message-Id: <comdog-ya02408000R2909981548010001@news.panix.com>
Keywords: from just another new york perl hacker
In article <36112a9b.4960861@news.iaehv.nl>, Focus12@xxbigfoot.com (Newbie) posted:
><input type=hidden name="username" value="thisismyusername">
>
>When someone press the submit button the form will open a file,
>look for the e-mail corresponding to the username, and then send
>the data to the user!
>P.S. If you like the idea and want to use it, let me know. I haven't
>seen any form that works like this before. Maybe because it takes too
>long to process?!?
you probably haven't seen it before because the Free Script Archivers
weren't that advanced, although this is a pretty standard technique
for real programmers. it's not going to be the bottleneck of a
CGI program unless you really work at it being slower than it has to
be.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>
------------------------------
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 3852
**************************************